Skip to content
Fleetline

Icon button

Usage

Use an icon button for frequent, well-known actions where space is tight: row actions in the work-order table, toolbar actions, the notification bell. If the icon isn't instantly recognizable to a new dispatcher, use a button with a text label instead.

Anatomy

  1. Container — <button type="button" class="icon-btn" aria-label="…">, square of the button height
  2. Icon — svg.icon-btn__icon, aria-hidden="true"
  3. Badge (optional) — .icon-btn__badge, decorative; the count lives in the accessible name

Examples

States marked hover, focus-visible and active are frozen with .is-hover, .is-focus-visible, .is-active. Those classes share their rule with the real pseudo-class, so what you see is exactly what users get. Never use them in product code.

Icon button

32px — dense tables and toolbars.

40px — default.

48px — tablet screens used with gloves.

Close the 2 open work orders before archiving this van.

Toggle icon buttons keep the same label and use aria-pressed.

<button type="button" class="icon-btn icon-btn--outline" aria-label="Edit work order WO-4182">
  <svg class="icon-btn__icon" aria-hidden="true" focusable="false"><use href="#icon-pencil"></use></svg>
</button>

<!-- Circle, small, large, emphasis -->
<button type="button" class="icon-btn icon-btn--circle" aria-label="More actions for van KX-219">…</button>
<button type="button" class="icon-btn icon-btn--sm" aria-label="Remove filter: Depot North Yard">…</button>
<button type="button" class="icon-btn icon-btn--lg icon-btn--primary" aria-label="Start inspection">…</button>

<!-- Toggle: same label, state in aria-pressed -->
<button type="button" class="icon-btn icon-btn--outline" aria-label="Pin van KX-219" aria-pressed="true">…</button>

<!-- Count belongs in the name; the badge is decorative -->
<button type="button" class="icon-btn icon-btn--outline" aria-label="Notifications, 3 unread">
  <svg class="icon-btn__icon" aria-hidden="true" focusable="false"><use href="#icon-bell"></use></svg>
  <span class="icon-btn__badge" aria-hidden="true">3</span>
</button>

API

HookValuesPurpose
.icon-btnblock classGhost icon button (default emphasis), square
.icon-btn--square | --circlemodifierShape
.icon-btn--outline | --primarymodifierEmphasis: secondary outline, primary fill
.icon-btn--sm | --lgmodifier32 / 48px (md 40px default), same as .btn--sm|lg
.icon-btn__icon, .icon-btn__badgepartIcon and decorative count
aria-labelattribute (required)Accessible name
aria-pressedattributeToggle state (selected colors + border)
disabled / aria-disabled="true"attributeUnavailable; aria-disabled stays focusable and explains why
.is-hover | .is-focus-visible | .is-activedocs-only classFreeze a state

Do and don't

Do name the action and the object in aria-label.
Don't use ambiguous icons or generic names; when in doubt, show a text label.

Accessibility

Keyboard interaction
KeyBehavior
TabMoves focus to the button (skipped when disabled)
Enter / SpaceActivates; toggles aria-pressed for toggle buttons

Tokens

Custom propertyPurpose
--button-height-sm | -md | -lgSquare size
--button-radius, --radius-fullSquare / circle shape
--color-action-{ghost|secondary|primary}-*Emphasis colors per state
--color-selected-bg | -fg | -borderPressed state
--color-action-danger-bg | -fgBadge
--icon-size-sm | -md | -lg, --icon-strokeIcon
--focus-ring-*Focus ring
--motion-duration-fastColor transitions