Components Feedback

Empty state

Show why a collection is empty and give the reader a relevant next step.

Live previewGo + HTML

No saved symbols

Browse the icon collection to find a symbol for your next project.

Browse icons

Usage

Describe the empty collection in Title and explain its cause in Body. The optional ActionHref and ActionLabel can lead to another view.

Register empty with Head and pass its properties to Render. Go setup guide

Go usage
Go usage
err := mono.UI.Render(w, "empty", mono.Props{
	"ActionHref":  "/icons.html",
	"ActionLabel": "Browse icons",
	"Body":        "Browse the icon collection to find a symbol for your next project.",
	"Title":       "No saved symbols",
})
Rendered HTML
Rendered HTML
<section data-mono="empty" id="demo-empty" class="mu-card mu-stack" aria-labelledby="demo-empty-title">
  <svg class="mu-empty-symbol" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
    <path d="M3 13.5 6.5 5h11L21 13.5V19H3z"/><path d="M3 13.5h5l1.5 2.5h5l1.5-2.5h5"/>
  </svg>
  <h3 id="demo-empty-title" class="mu-title">No saved symbols</h3>
  <p class="mu-muted">Browse the icon collection to find a symbol for your next project.</p>
  <a class="mu-btn mu-primary" href="/icons.html">Browse icons</a>
</section>
Go template
Go template
<section data-mono="empty" id="{{.ID}}" class="mu-card mu-stack" aria-labelledby="{{.ID}}-title">
  <svg class="mu-empty-symbol" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
    <path d="M3 13.5 6.5 5h11L21 13.5V19H3z"/><path d="M3 13.5h5l1.5 2.5h5l1.5-2.5h5"/>
  </svg>
  <h3 id="{{.ID}}-title" class="mu-title">{{.Title}}</h3>
  <p class="mu-muted">{{.Body}}</p>
  {{if and .ActionHref .ActionLabel}}<a class="mu-btn mu-primary" href="{{.ActionHref}}">{{.ActionLabel}}</a>{{end}}
</section>
Component CSS
Component CSS
[data-mono="empty"] { align-items:center; text-align:center; border-style:dashed; padding:clamp(1.25rem,4vw,2.25rem); }
[data-mono="empty"] .mu-empty-symbol { justify-self:center; color:var(--mu-muted); }
Use the HTML in a static site

Copy the rendered HTML above. Download these assets into the same folder as your page, then add the tags below to its head.

Shared CSS Component CSS

HTML head
<link rel="stylesheet" href="./base.css">
<link rel="stylesheet" href="./empty.css">

Copy into your project

Run this command from the Mono checkout. Set -out to the component directory in your application.

Terminal
go run ./cmd/mono-ui add -out ./components empty
Example properties (JSON)
example.json
{
  "ActionHref": "/icons.html",
  "ActionLabel": "Browse icons",
  "Body": "Browse the icon collection to find a symbol for your next project.",
  "Title": "No saved symbols"
}