Components Data display

Badge

Place a concise state or category label beside a title or item.

Live previewGo + HTML
In production

Usage

Set Text to the full state name. Use Variant equal to solid for emphasis or outline for a neutral badge. The label should remain meaningful on its own.

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

Go usage
Go usage
err := mono.UI.Render(w, "badge", mono.Props{
	"Text":    "In production",
	"Variant": "solid",
})
Rendered HTML
Rendered HTML
<span data-mono="badge" id="demo-badge" class="mu-badge" data-variant="solid">In production</span>
Go template
Go template
<span data-mono="badge" id="{{.ID}}" class="mu-badge" data-variant="{{.Variant}}">{{.Text}}</span>
Component CSS
Component CSS
[data-mono="badge"][data-variant="solid"] { background:#171717; border-color:#171717; color:#fff; }
[data-mono="badge"][data-variant="outline"] { background:transparent; color:inherit; }
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="./badge.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 badge
Example properties (JSON)
example.json
{
  "Text": "In production",
  "Variant": "solid"
}