Components Feedback

Alert

Highlight a message and its supporting detail within the page.

Live previewGo + HTML

Proof ready

The revised cover is ready for your final review.

Usage

Title and Body describe the condition and its effect. When adding a newly triggered urgent warning, set Urgent to true to announce it with the alert role.

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

Go usage
Go usage
err := mono.UI.Render(w, "alert", mono.Props{
	"Body":   "The revised cover is ready for your final review.",
	"Title":  "Proof ready",
	"Urgent": false,
})
Rendered HTML
Rendered HTML
<section data-mono="alert" id="demo-alert" class="mu-panel" aria-labelledby="demo-alert-title" >
  <span aria-hidden="true" class="mu-alert-mark">i</span>
  <div class="mu-stack"><h3 id="demo-alert-title" class="mu-label">Proof ready</h3><p class="mu-small mu-muted">The revised cover is ready for your final review.</p></div>
</section>
Go template
Go template
<section data-mono="alert" id="{{.ID}}" class="mu-panel" aria-labelledby="{{.ID}}-title" {{if .Urgent}}role="alert"{{end}}>
  <span aria-hidden="true" class="mu-alert-mark">i</span>
  <div class="mu-stack"><h3 id="{{.ID}}-title" class="mu-label">{{.Title}}</h3><p class="mu-small mu-muted">{{.Body}}</p></div>
</section>
Component CSS
Component CSS
[data-mono="alert"] { display:flex; align-items:flex-start; gap:.75rem; }
[data-mono="alert"] .mu-alert-mark { display:inline-grid; place-items:center; flex:none; width:1.15rem; height:1.15rem; margin-top:.1rem; border:1.5px solid currentColor; border-radius:50%; font:italic 700 .8rem Georgia,serif; }
[data-mono="alert"] .mu-stack { gap:.2rem; }
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="./alert.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 alert
Example properties (JSON)
example.json
{
  "Body": "The revised cover is ready for your final review.",
  "Title": "Proof ready",
  "Urgent": false
}