Button
Flat by default: an ink border and a light tint on hover. Add a hard shadow, a press effect or a lift only where you want it.
Basic
Use .btn on a <button> or a link. Plain .btn is white with ink text.
<button class="btn" type="button">Cancel</button>
<button class="btn btn-brand" type="button">Save settings</button>
<a class="btn" href="#">A link</a>Colors
.btn-<color> fills it with any palette color and ink text. .btn-brand uses the brand color (ink by default). .btn-ink is solid black (white in dark mode).
<button class="btn btn-yellow" type="button">Yellow</button>
<button class="btn btn-violet" type="button">Violet</button>
<button class="btn btn-cyan" type="button">Cyan</button>
<button class="btn btn-green" type="button">Green</button>
<button class="btn btn-orange" type="button">Orange</button>
<button class="btn btn-pink" type="button">Pink</button>
<button class="btn btn-red" type="button">Red</button>
<button class="btn btn-blue" type="button">Blue</button>
<button class="btn btn-lime" type="button">Lime</button>
<button class="btn btn-gray" type="button">Gray</button>
<button class="btn btn-ink" type="button">Ink</button>Ghost and link
.btn-ghost has no border or background: the ink outline appears on hover. .btn-link looks like a link.
<button class="btn btn-ghost" type="button">Ghost</button>
<button class="btn btn-link" type="button">View details</button>Shadow, press and raise
Buttons are flat until you ask. .btn-shadow adds a still hard shadow. .btn-press adds the shadow, lifts on hover and pushes into it when clicked. .btn-raise is flat at rest and lifts with its shadow on hover. To turn shadows on everywhere, put class="momo-shadows" on <html> (then .btn-flat keeps one flat).
<button class="btn btn-brand" type="button">Flat (default)</button>
<button class="btn btn-brand btn-shadow" type="button">btn-shadow</button>
<button class="btn btn-brand btn-press" type="button">btn-press</button>
<button class="btn btn-brand btn-raise" type="button">btn-raise</button>With icons
Put a Moey icon before or after the text.
<button class="btn btn-brand" type="button"><i class="mi mi-save"></i> Save settings</button>
<button class="btn" type="button"><i class="mi mi-download"></i> Download</button>
<button class="btn btn-ink" type="button">Next <i class="mi mi-arrow-right"></i></button>
<button class="btn btn-sm" type="button"><i class="mi mi-check-check"></i> Mark read</button>Icon buttons
.btn-icon makes it square. Always give it an aria-label. Add .btn-pill for a round one.
<button class="btn btn-icon" type="button" aria-label="Back"><i class="mi mi-arrow-left"></i></button>
<button class="btn btn-icon" type="button" aria-label="Menu"><i class="mi mi-menu"></i></button>
<button class="btn btn-icon btn-brand" type="button" aria-label="Add"><i class="mi mi-plus"></i></button>
<button class="btn btn-icon btn-sm" type="button" aria-label="More"><i class="mi mi-ellipsis"></i></button>
<button class="btn btn-icon btn-pill btn-lg btn-brand" type="button" aria-label="New task"><i class="mi mi-plus"></i></button>Sizes
.btn-sm (32px), default (40px), .btn-lg (52px). On touch screens every size grows a little so it is easy to tap.
<button class="btn btn-sm btn-violet" type="button">Small</button>
<button class="btn btn-violet" type="button">Default</button>
<button class="btn btn-lg btn-violet" type="button">Large</button>Shapes
.btn-pill for filter chips, .btn-block for full width (common on phones).
<div class="btn-row">
<button class="btn btn-pill btn-ink" type="button">All</button>
<button class="btn btn-pill" type="button">Mentions</button>
<button class="btn btn-pill" type="button">System</button>
</div>
<hr>
<button class="btn btn-lg btn-block btn-brand" type="button"><i class="mi mi-save"></i> Save settings</button>Selected
For toggles, set aria-pressed="true" (or .is-active). The button turns ink.
<button class="btn btn-sm" type="button" aria-pressed="true">Monthly</button>
<button class="btn btn-sm" type="button" aria-pressed="false">Yearly</button>Disabled and loading
Use the disabled attribute on buttons, aria-disabled="true" on links. .is-loading shows a spinner and keeps the width.
<button class="btn btn-brand" type="button" disabled>Disabled</button>
<a class="btn" href="#" aria-disabled="true">Disabled link</a>
<button class="btn btn-brand is-loading" type="button" aria-busy="true"><span>Saving</span></button>Row of buttons
.btn-row lines buttons up with a gap and wraps them on small screens.
<div class="btn-row">
<button class="btn btn-brand" type="button">Publish</button>
<button class="btn" type="button">Save draft</button>
<button class="btn btn-ghost" type="button">Cancel</button>
</div>Close button
A ready-made × for dialogs, banners and cards: .btn-close (the × is a Moey icon, so no <i> is needed). It takes the text color; .btn-close-sm and -lg change its size. It has no words, so always give it an aria-label.
<button class="btn-close btn-close-sm" type="button" aria-label="Close"></button>
<button class="btn-close" type="button" aria-label="Close"></button>
<button class="btn-close btn-close-lg" type="button" aria-label="Close"></button>
<span class="box bg-ink p-2 hstack gap-2">On dark <button class="btn-close" type="button" aria-label="Close"></button></span>Joined buttons are on the Button group page.
Accessibility
- Use
<button type="button">for actions and<a>for navigation. - Icon-only buttons need an
aria-label. - Keyboard focus shows a thick blue ring.
- The press motion is turned off when the system asks for reduced motion.
Variables
Set these on a button (or a parent) to make your own variant.
| Variable | Default |
|---|---|
--btn-bg / --btn-color | Surface / ink |
--btn-border | Ink line |
--btn-depth | 0 = flat (default), 1 = shadow (.btn-shadow, .btn-press) |
--btn-scale | Shadow size: .5 small, .75 default, 1 large |
--btn-height | 2.5rem (2.75rem on touch) |
--btn-pad / --btn-font-size | 1rem / 1rem |
--btn-radius | --momo-radius |