Components Layout

Card

Group a heading, a short description, and a related action on one surface.

Live previewGo + HTML

Studio library

A field guide to paper

Compare grain, weight, and finish before sending the next edition to print.

Usage

Set Title and Body to the content you want to feature. ActionHref and ActionLabel add a link. Leave the action out for a passive card.

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

Go usage
Go usage
err := mono.UI.Render(w, "card", mono.Props{
	"ActionHref":  "/docs.html",
	"ActionLabel": "Read the field guide",
	"Body":        "Compare grain, weight, and finish before sending the next edition to print.",
	"Kicker":      "Studio library",
	"Title":       "A field guide to paper",
})
Rendered HTML
Rendered HTML
<article data-mono="card" id="demo-card" class="mu-card mu-stack">
  <p class="mu-small mu-muted">Studio library</p>
  <h3 class="mu-title">A field guide to paper</h3>
  <p class="mu-muted">Compare grain, weight, and finish before sending the next edition to print.</p>
  <div><a class="mu-btn" href="/docs.html">Read the field guide</a></div>
</article>
Go template
Go template
<article data-mono="card" id="{{.ID}}" class="mu-card mu-stack">
  {{with .Kicker}}<p class="mu-small mu-muted">{{.}}</p>{{end}}
  <h3 class="mu-title">{{.Title}}</h3>
  <p class="mu-muted">{{.Body}}</p>
  {{if and .ActionHref .ActionLabel}}<div><a class="mu-btn" href="{{.ActionHref}}">{{.ActionLabel}}</a></div>{{end}}
</article>
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

HTML head
<link rel="stylesheet" href="./base.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 card
Example properties (JSON)
example.json
{
  "ActionHref": "/docs.html",
  "ActionLabel": "Read the field guide",
  "Body": "Compare grain, weight, and finish before sending the next edition to print.",
  "Kicker": "Studio library",
  "Title": "A field guide to paper"
}