Components Disclosure
Collapsible
Keep supporting details within reach using a native disclosure.
Production notes
Printed in two passes using carbon black ink. Allow one working day for drying before trimming.
Usage
Choose a Label that describes the hidden content. Set Open to show it initially. The disclosure works with pointer, touch, Enter, and Space.
Register collapsible with Head and pass its properties to Render. Go setup guide
Go usage
err := mono.UI.Render(w, "collapsible", mono.Props{
"Description": "Printed in two passes using carbon black ink. Allow one working day for drying before trimming.",
"Label": "Production notes",
})Rendered HTML
<details id="demo-collapsible" data-mono="collapsible" class="mu-card">
<summary class="mu-label mu-disclosure">Production notes</summary>
<p class="mu-muted">Printed in two passes using carbon black ink. Allow one working day for drying before trimming.</p>
</details>Go template
<details id="{{.ID}}" data-mono="collapsible" class="mu-card"{{if .Open}} open{{end}}>
<summary class="mu-label mu-disclosure">{{.Label}}</summary>
<p class="mu-muted">{{.Description}}</p>
</details>Component CSS
[data-mono="collapsible"] { width: min(100%, 24rem); }
[data-mono="collapsible"] summary { cursor: pointer; }
[data-mono="collapsible"] p { margin: .75rem 0 0; }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.
<link rel="stylesheet" href="./base.css">
<link rel="stylesheet" href="./collapsible.css">Copy into your project
Run this command from the Mono checkout. Set -out to the component directory in your application.
go run ./cmd/mono-ui add -out ./components collapsibleExample properties (JSON)
{
"Description": "Printed in two passes using carbon black ink. Allow one working day for drying before trimming.",
"Label": "Production notes"
}