Skip to content
Fleetline

Close button

Usage

Use the close button to dismiss an overlay or a dismissible message: dialogs, drawers, toasts, alerts, popovers. It always sits in the top inline-end corner so mechanics and dispatchers find it in the same place everywhere.

Anatomy

  1. Container — <button type="button" class="close-btn" aria-label="Close">, ghost, square
  2. Icon — svg.close-btn__icon ("x"), aria-hidden="true"

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.

Close button

Only while a dialog is saving; say so in the dialog ("Saving work order…").

Van KX-219

Next service due in 3 days at North Yard depot.

Top inline-end corner, the same place in dialogs, drawers, toasts, alerts and popovers.

<button type="button" class="close-btn" aria-label="Close">
  <svg class="close-btn__icon" aria-hidden="true" focusable="false"><use href="#icon-x"></use></svg>
</button>

<!-- In a dialog: the invoker closes it without JS -->
<button type="button" class="close-btn" aria-label="Close" commandfor="assign-dialog" command="close">…</button>

<!-- Toasts and alerts: small + specific name -->
<button type="button" class="close-btn close-btn--sm" aria-label="Dismiss notification">…</button>

API

HookValuesPurpose
.close-btnblock class40px ghost close button
.close-btn--sm | --lgmodifier32px (toasts, alerts) / 48px (tablet)
.close-btn__iconpartThe x icon
aria-labelattribute (required)"Close" or a specific name
commandfor + command="close"attributeCloses a <dialog> declaratively
disabledattributeOnly while saving
.is-hover | .is-focus-visible | .is-activedocs-only classFreeze a state

Do and don't

Do give it a specific name when several dismiss buttons share a screen.
Don't use a letter "X" as text — screen readers read "X".

Accessibility

Keyboard interaction
KeyBehavior
Enter / SpaceCloses the surface
EscHandled by the surface (dialog/popover), not the button — keep both

Tokens

Custom propertyPurpose
--button-height-*, --button-radiusSize and shape
--color-text-muted | -defaultIcon color, rest / hover
--color-action-ghost-bg-hover | -bg-activeState fills
--icon-size-*, --icon-strokeIcon
--focus-ring-*Focus ring