Buttons & Badges
A button is built from three independent decisions: color, size, appearance. This page lists every option and explains when it's okay to break the 44px rule. Ready-made sets are in the examples.
1. Anatomy
The shape, the 44px height, and the focus ring come from the
.btn base - but a color class implies
it on its own, so .btn-primary is
enough. Everything else is a modifier that can be combined,
but one per group.
<button class="btn-primary">Save</button>
<button class="btn-primary btn-lg">Bigger</button>
<button class="btn-outline-primary btn-sm">Outline, smaller</button>
<!-- Works on any element -->
<a href="/pricing" class="btn-secondary">See pricing</a>
<!-- .btn alone is still needed when you don't provide a color -->
<button class="btn">Neutral</button>
What the implication doesn't cover
Only the color classes
(.btn-primary … .btn-dark) and
their outline variants carry the base. Size modifiers
(.btn-lg) and appearance modifiers
(.btn-3d, .btn-glass) are
add-ons - on their own they don't create a button. A
special case is .btn-action, which
deliberately doesn't inherit the base, since it breaks the
44px rule.
Colors
| Class | When |
|---|---|
.btn-primary |
The screen's main action. One per view. |
.btn-secondary |
A secondary action: Cancel, Back. |
.btn-success |
Confirmation, process completion. |
.btn-danger |
An irreversible action: Delete, Terminate contract. |
.btn-warning |
An action that needs attention. |
.btn-info |
A neutral, informational action. |
.btn-dark |
Contrast against the background. Inverts in dark mode
along with --dark.
|
.btn-light |
A button on a dark background. |
Sizes
| Class | What for |
|---|---|
.btn-xs |
Very small. Drops below the touch target - only where clicking isn't the primary path. |
.btn-sm |
Filter bars, actions inside cards. |
.btn-md |
The default size, spelled out explicitly. |
.btn-lg |
Contact forms, calls to action. |
.btn-xl |
The main button in a hero section. |
2. Appearance variants
They change how a button is drawn, not what it means. The outline variant has a version for every color; the rest work on any of them.
| Class | Appearance |
|---|---|
.btn-outline-primary |
Just a border, background fills in only on hover. The
variant exists for every color:
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-danger,
.btn-outline-warning,
.btn-outline-info,
.btn-outline-dark,
.btn-outline-light.
|
.btn-outline-soft |
A softened outline: a 30%-opacity border, a 10% background on hover. You add it on top of the outline variant. |
.btn-3d |
A "base" shadow that presses in on click. The base
color lives in --btn-3d-shadow - set it
yourself when using a color other than primary.
|
.btn-glass |
Frosted glass. Only on a photo or a gradient - on a solid background there's nothing to blur. See pitfall #2. |
.btn-glow |
A glow that grows on hover. |
.btn-gradient |
A background transitioning primary → info. Ignores the color class. |
.btn-shine |
A reflection sweeping across the button. |
.btn-stacked |
Icon above the label instead of beside it - a toolbar, an app's bottom navigation. |
.btn-text |
The label inside .btn-stacked - small,
uppercase. Not a separate button
variant.
|
.btn-icon |
Icon-only button: fixed width and height via
--btn-icon-size (36px by default)
instead of padding - a square with no juggling. Add
.rounded-circle for a circle. Size
modifiers: .btn-icon-sm (28px),
.btn-icon-lg (48px) - on touch it still
grows to the full 44px target regardless of the
modifier.
|
<button class="btn btn-outline-primary btn-outline-soft">Soft outline</button>
<button class="btn btn-primary btn-stacked">
<svg>…</svg>
<span class="btn-text">Save</span>
</button>
<!-- Square: .btn-icon alone. Circle: add .rounded-circle.
No visible text - always an aria-label. -->
<button class="btn btn-outline-success btn-icon rounded-circle" aria-label="Play">
<svg class="icon" aria-hidden="true"><use href="img/icons-sprite.svg#ph-play"></use></svg>
</button>
3. Hover effect
Instead of marking every button individually, you pick the
effect once for the whole area - via a class
on <body> or on a container. Every
.btn inside inherits it.
<body class="btn-hover-spring">
<button class="btn btn-primary">Inherits the spring</button>
<!-- A button's own hover-* class takes priority -->
<button class="btn btn-primary hover-scale">Scales instead</button>
</body>
| Class | Effect |
|---|---|
.btn-hover-spring |
Scaling up with a springy overshoot. |
.btn-hover-lift |
Lifting upward. |
.btn-hover-glow |
A glow around the button. |
How the priority works
The rule targets .btn:not([class*="hover-"]),
i.e. it skips buttons that already have their own
hover- class. That means you make an exception
by adding a class, not by fighting specificity. The effect
can also be picked in the
theme editor.
Effects outside the buttons module
The hover-* classes from the utility module
aren't tied to any single component - they work on any
element, so on a button too. Below are the ones that make
sense on one, along with what they require. Full galleries:
micro-interactions
and border effects.
| Class | Effect | On a button |
|---|---|---|
.hover-scale |
Scaling up. Strength set by --hover-scale.
|
no issues |
.hover-shadow |
Lifting with a shadow. Height: --hover-y.
|
no issues |
.hover-gpu-shadow |
A growing shadow without animating box-shadow.
|
no issues |
.hover-tilt |
A fixed 3D tilt. | no issues |
.hover-border-draw |
A rounded border drawn outward from the center. |
no issues
Draws in its own ::before, so it doesn't touch the button's background.
|
.hover-border-trace |
A light traveling around the outline, rounded. |
no issues
Also ::before.
|
.hover-border-draw-2 |
A border drawn side by side, sharp corners. | set the color See the note below the table. |
.hover-border-trace-2 |
An outline traced side by side, sharp corners. | set the color See the note below the table. |
.tilt-card |
A tilt following the cursor. | requires JS Disables itself on touch. |
.bg-hover-*,
.text-hover-*,
.border-hover-*
|
A color change on hover. |
not recommended
A button already has its own hover color from its
variant - these classes compete with it. Change
--primary-hover instead of adding the utility.
|
Why the -2 variants need a color
The sharp-corner variants don't draw a pseudo-element - the
lines are four gradients in the element's own
background-image. The button's background
(background-color) is left untouched, so
technically they work. The problem is visual: the line
defaults to the --primary color, meaning it's
invisible on a .btn-primary.
<button class="btn btn-primary hover-border-draw-2"
style="--hover-border-color: #fff;">White border</button>
4. Action buttons and groups
Ghost buttons
.btn-action is the only button in molique that
deliberately drops below 44px. The reason is
practical: in a table with dozens of rows, full-size buttons
push the rows apart so much that only five fit on screen.
This is an exception allowed for dense listings - not a regular button.
<div class="btn-action-group with-dividers">
<button class="btn-action">Edit</button>
<button class="btn-action text-danger">Delete</button>
</div>
Button groups
Glue a series of buttons into a single bar - a view switch, a
toolbar. The rounded corners between them disappear on their
own. Mark the current position with .is-active.
<div class="btn-group">
<button class="btn btn-outline-dark is-active">List</button>
<button class="btn btn-outline-dark">Tiles</button>
</div>
| Class | What it does |
|---|---|
.btn-action |
A button with no background or border, for dense tables. |
.btn-action-group |
Groups a single row's actions next to each other. |
.with-dividers |
Adds vertical dividers between actions. A [popover] menu standing in the group takes no divider and does not count as the last item. Only with
.btn-action-group. The divider hangs off
the group's direct child, not off the
button - a POST action needs its own
<form> (method + nonce), so a button
is often the only child of its own form. Wrapping in a
<form> is accounted for: the wrapper
neither breaks the row nor adds height of its own.
|
.btn-group |
A bar of glued-together buttons. |
.is-active |
The pressed position in a group. |
5. Badges
A status pill - a non-clickable label next to a record. Color is for communicating state, not decoration: a red badge on every row stops meaning anything.
| Class | Typical use |
|---|---|
.badge |
The base - shape, size, spacing. |
.badge-primary |
Neutral emphasis. |
.badge-success |
Active, paid, completed. |
.badge-warning |
Pending, needs attention. |
.badge-danger |
Overdue, rejected, error. |
.badge-info |
An annotation, an intermediate stage. |
.badge-secondary |
Draft, an irrelevant state. |
.badge-light |
A neutral label, e.g. a counter next to a filter. Dark text on a light background, the other way round in dark mode. A bare .badge with no variant looks like .badge-secondary. |
.badge-dark |
Archived, closed. |
When to use a dot instead of a badge
If there's one status per row and it doesn't need a
caption, .status-dot takes up less space and
doesn't compete visually with the content. Described in
extra components.
6. Pitfalls
1
.btn-action outside a table
This button looks tidy, so it's tempting to use it everywhere. But it's a deliberate exception to the 44px rule - allowed only because in a dense table the alternative is worse. Used in a form or on a pricing page it simply breaks the touch target: hard to hit with a finger on a phone.
2
.btn-glass on a solid background
The glass effect works by blurring whatever is underneath the button. On a solid background there's nothing to blur - you're left with a barely visible rectangle. This variant only makes sense on a photo, a gradient, or animated blobs.
Its background and border are also written with
!important, to win against the color class
- so you cannot override them with a regular
background class. Change them with an inline
style on the element, or don't use this variant.
3
.btn-3d in a color other than primary
The "base" color underneath the button is
--btn-3d-shadow, which defaults to
--primary-hover. A green button would
therefore get a purple base and look broken. Set the
variable together with the color.
<button class="btn btn-success btn-3d"
style="--btn-3d-shadow: var(--success-hover);">Save</button>
4 A class name concatenated with status from the backend
A common instinct when generating a table:
class="badge badge-<?= $status ?>".
Such a name never appears in the source as a literal, so
PurgeCSS can't see it and strips it - after deployment
every status is colorless. Map the status to a literal,
or add the pattern to the safelist.
// WRONG
'badge badge-' + status
// RIGHT - a literal map, validates the input along the way
const BADGE = { active: 'badge-success', pending: 'badge-warning' };
BADGE[status] || 'badge-secondary';
5
Several .btn-primary buttons next to each other
This isn't a technical error, just a loss of
information. Primary means "this is probably the action
you want to take". Three such buttons in one place say
nothing at all. Keep one, make the rest
.btn-secondary or outline.