Skip to content
Alea0.1

Actions

Button

Starts an action. Five looks for five jobs, three sizes, icons and a loading state.

Ant Design: Button

import { Button } from '@alea/ui';

Examples

Variants

Primary for the main action, secondary (the chip) for the second, ghost for the rest, danger for destructive actions and link for low emphasis.

Sizes

sm 32 px, md 40 px (default), lg 48 px.

With icons

Icons before or after the label. They are hidden from screen readers; the label names the button.

Loading and disabled

isLoading keeps the width and the name, shows a spinner and ignores presses until done.

Full width

For forms on small screens and stacked layouts.

Props

Button props

The action button: five looks, three sizes, icons and a loading state.

PropTypeDefaultDescription
fullWidthboolean-Stretches to the width of its container.
iconEndReactNode-Icon after the label.
iconStartReactNode-Icon before the label.
isLoadingboolean-Shows a spinner, keeps the width and tells screen readers it is busy.
size"sm" | "md" | "lg"'md'sm 32 px, md 40 px (default), lg 48 px.
variant"primary" | "secondary" | "ghost" | "danger" | "link"'primary'primary: the dark gradient button; secondary: the chip (white on dark, black on light); ghost: outlined; danger: destructive; link: text only.

Accessibility

  • Built on React Aria Button: a real button element, pressed by mouse, touch, Enter and Space, with focus ring only for keyboard focus.
  • While loading, the button keeps its accessible name and is announced as busy, and presses are ignored.
  • Disabled buttons are not focusable; when the reason matters, keep it enabled and explain on press instead.

Keyboard

KeyDoes
TabMoves focus to the button
Enter or SpacePresses it

Do and don't

Do

  • One primary button per view: the action you want people to take.
  • Write the action as a verb: Save changes, not OK.
  • Use danger only for actions that lose data, and confirm them.

Don't

  • Don't use a button to go to another page: use Link.
  • Don't put two primary buttons side by side.
  • Don't rely on color alone to tell danger apart; the label says it.

In Figma

Button component set: Variant (Primary, Secondary, Ghost, Danger, Link) × Size (Small, Medium, Large) × State (Default, Hover, Pressed, Focus, Disabled, Loading), with boolean properties for the icons.

Tested with axe, keyboard and screen reader roles