Button
Pick a color, then — if you like — a strength. Flat by default; only outline buttons have a border.
<button class="btn">Neutral</button>
<button class="btn btn-blue">Blue</button>
<button class="btn btn-green btn-vivid">Green, vivid</button>
<button class="btn btn-red btn-subtle">Red, subtle</button>
<button class="btn btn-gray btn-ghost">Gray, ghost</button>
Colors
btn-<color> with any of the 14 palette colors — btn-blue, btn-green, btn-red, btn-amber… — plus btn-light, btn-dark, btn-inverse and btn-default (the default color — Moey's tuxedo black, white in dark mode, unless you change it). A plain btn is neutral gray: Cancel, Export, Edit.
Strengths
A color alone gives the soft default fill. Add a strength to go lighter or stronger. Hover always goes one shade further and pressing two, so every strength feels the same. Light colors (yellow, amber, lime…) keep dark text so they stay readable.
<button class="btn btn-green btn-subtle">…</button> <!-- lightest tint -->
<button class="btn btn-green btn-soft">…</button>
<button class="btn btn-green">…</button> <!-- default: just the color -->
<button class="btn btn-green btn-solid">…</button>
<button class="btn btn-green btn-vivid">…</button>
<button class="btn btn-green btn-deep">…</button> <!-- darkest -->
<button class="btn btn-green btn-outline">…</button>
<button class="btn btn-green btn-ghost">…</button>
<button class="btn btn-green btn-link">…</button>
| Class | Looks like | Use it for |
|---|---|---|
.btn | Neutral gray | Everyday actions — Cancel, Export, Edit |
.btn-subtle | The lightest tint, colored text | Secondary actions that still need color |
.btn-soft | A light fill | Quiet but clearly colored |
| (just a color) | The soft default fill (*-300), dark text | The main action on a page or form |
.btn-solid | The full color (*-500) | When it should stand out more |
.btn-vivid | Stronger (*-600), white text | Bold calls to action |
.btn-deep | The darkest (*-800), white text | Dark UIs, high emphasis |
.btn-outline | Border + colored text; tinted on hover | When you specifically want an outlined look |
.btn-ghost | Colored text; tinted on hover | Toolbars, icon buttons, low-priority actions |
.btn-link | Looks like a link | An action that should read like a link |
Need one exact shade? Use the color utilities: class="btn bg-green-400 text-white". A strength without a color uses your default color; theme-green on a button works like btn-green.
Sizes
<button class="btn btn-default btn-xs">…</button> <!-- 28px -->
<button class="btn btn-default btn-sm">…</button> <!-- 32px -->
<button class="btn btn-default">…</button> <!-- 38px -->
<button class="btn btn-default btn-lg">…</button> <!-- 44px -->
Icons
Put a Moey icon inside — font or SVG, it's sized to the text automatically. For icon-only buttons add .btn-icon (square) and always an aria-label.
<button class="btn btn-default"><i class="mi mi-plus"></i>New order</button>
<button class="btn btn-gray btn-ghost btn-icon" aria-label="More">
<i class="mi mi-ellipsis"></i>
</button>
<!-- SVG version: adjustable stroke -->
<button class="btn btn-default"><svg class="mi mi-stroke-1.5"><use href="icons/dist/moey-icons.svg#mi-plus"/></svg>New order</button>
States
Loading: set aria-busy="true" — the label hides, a spinner shows, clicks are blocked, and screen readers announce it as busy. Remove the attribute when done.
<button class="btn btn-default" aria-busy="true">Saving</button>
<button class="btn btn-default" disabled>Disabled</button>
<a class="btn btn-default disabled" aria-disabled="true">Disabled link</a>
<button class="btn btn-ghost active">Active</button> <!-- or aria-pressed="true" -->
Customize
Every button reads its look from variables, so you can make your own variant or tweak one button:
/* Pill-shaped buttons everywhere */
:root { --mo-radius-control: 50rem; }
/* Your own variant */
.btn-brand {
--mo-btn-bg: #ff5a1f;
--mo-btn-color: #fff;
--mo-btn-hover-bg: #e64a12;
}
| Variable | Controls |
|---|---|
--mo-btn-height, --mo-btn-padding-x | Size |
--mo-btn-font-size, --mo-btn-font-weight | Text |
--mo-btn-radius | Corners |
--mo-btn-color, --mo-btn-bg, --mo-btn-border | Colors |
--mo-btn-hover-*, --mo-btn-active-bg | Hover & pressed colors |
Links that look like buttons
Use <a> when the button goes somewhere — same classes.
<a class="btn btn-default" href="#button">Create account</a>
<a class="btn" href="#button"><i class="mi mi-download"></i>Download CSV</a>
<a class="btn btn-link" href="#button">Learn more <i class="mi mi-arrow-right"></i></a>
Form actions
The main action last, the safe one before it. On phones, full-width buttons are easier to tap.
<div class="card-footer justify-end">
<button class="btn btn-gray btn-ghost">Cancel</button>
<button class="btn btn-default">Save changes</button>
</div>
Toolbar
Icon buttons in a row — their aria-label becomes a tooltip automatically.
<div class="flex gap-1 items-center">
<button class="btn btn-gray btn-ghost btn-icon btn-sm" aria-label="Bold">
<i class="mi mi-bold"></i>
</button>
<button class="btn btn-gray btn-ghost btn-icon btn-sm" aria-label="Italic">
<i class="mi mi-italic"></i>
</button>
<button class="btn btn-gray btn-ghost btn-icon btn-sm" aria-label="Link">
<i class="mi mi-link"></i>
</button>
<span class="divider-vertical h-5 mx-1"></span>
<button class="btn btn-gray btn-ghost btn-icon btn-sm" aria-label="Undo">
<i class="mi mi-undo-2"></i>
</button>
<button class="btn btn-gray btn-ghost btn-icon btn-sm" aria-label="Redo">
<i class="mi mi-redo-2"></i>
</button>
</div>
Danger zone
Destructive actions: quiet until needed, red when it matters.
<div class="card"><div class="card-body flex flex-wrap gap-4 items-center justify-between">
<div>
<div class="card-title">Delete this store</div>
<div class="card-subtitle">All orders, customers and products are removed for good.</div>
</div>
<button class="btn btn-red btn-outline"><i class="mi mi-trash-2"></i>Delete store</button>
</div></div>
Full width
Stretch a button to its container — handy for sign-in forms and phone layouts.
<div class="grid grid-cols-1 gap-2 max-w-sm">
<button class="btn btn-default">Sign in</button>
<button class="btn"><i class="mi mi-mail"></i>Continue with email</button>
</div>