Button

ui.css · APG: Button · Cross-system: Cross-system reference § Actions

Overview

Use .btn for a standard button and add at most one variant class to describe the action’s role, such as btn outline. Prefer these shared styles. If a new use case needs another variant, add it to the library so other callers can use it.

Anatomy

A native <button> with class="btn" and optionally one variant class (.outline, .ghost, .destructive) plus stackable modifiers (.sm, .full-width, [aria-pressed]).

Choose at most one variant and any number of modifiers. Modifiers lists the supported combinations and explains when appearance follows an attribute, such as aria-pressed, instead of a class.

Usage

Show code

Variants

Show code

Modifiers

Stackable with any variant — see Modifiers for the full list.

Show code

Every variant with each modifier and state. The headers name the classes and attributes on each button.

plain.sm[aria-pressed="true"][disabled]
.btn
.btn.outline
.btn.ghost
.btn.destructive

States

Hover and focus-visible are defined in /ui/ui.css. Disabled via the native disabled attribute (opacity 0.5, pointer-events: none) or aria-disabled="true" when the button must remain focusable (opacity 0.5, cursor: not-allowed — the button still takes focus and still fires click).

Icon button

Icon-only buttons use .btn-icon (distinct from .btn): a fixed --size-7 square with a transparent background, so it holds one glyph and no label. Its <ui-icon> child is rendered larger than an icon sitting beside a text label in .btn, so the icon fills an appropriate amount of the button. Always provide an accessible name.

Show code

Accessibility

Cross-system

See Cross-system reference § Actions for mappings to Material Web md-button, Bootstrap .btn, and WAI-ARIA APG.

See also