Skip to main content
HahlexMillarv0.1.0 Draft
ComponentsDraftWCAG 2.1/2.2 AAZero Gradients@hahlex/millar-ui

Button

Primary action control with 7 semantic variants, async double-click protection (aria-busy), high-contrast outlined danger variant, and 2px keyboard focus ring.

Interactive Playground

Live component specimen driven directly by Millar tokens in Light and Dark mode.

Lock 3rd button (disabled)
Interactive event readoutClick any button above to test async busy-guard locking or live press events.
@hahlex/millar-ui
import { Button, IconAdd } from "@hahlex/millar-ui";

<Button variant="primary" icon={<IconAdd size="md" />} onClick={handleCreate}>
  Create workspace
</Button>

Props API

Button component props
PropTypeDefaultDescription
variant"primary" | "secondary" | "white" | "ghost" | "danger" | "success" | "row""white"Visual role mapped strictly to Millar surface and contrast tokens.
size"sm" | "md" | "lg""md"Heights: sm=32px, md=40px, lg=44px.
pillbooleanfalseApplies --radius-pill (9999px) for starter or filter pill buttons.
iconOnlybooleanfalseSquare icon button; REQUIRES explicit aria-label.
loadingbooleanfalseExternal loading state (also auto-enabled while async onClick Promise settles).
iconReactNode-Leading semantic icon from @hahlex/millar-ui/icons (1.5px stroke).

Usage Guidelines & Agent Guardrails

When to use
  • Use 'primary' at most once per PageHeader or Dialog footer for the single main action.
  • Use 'white' or 'secondary' for supporting actions and toolbar buttons.
  • Use 'danger' paired with ConfirmDialog for irreversible destructive actions.
Responsive behavior

Maintains >= 40px default height (44px lg) and >= 32px icon-only dimensions; wraps cleanly inside PageHeader action groups below 640px.

Anti-Hallucination Guardrails (AI & Human)
  • Do NOT pass variant='destructive', variant='outline', or variant='link' (use 'danger', 'white', or 'ghost').
  • Do NOT render iconOnly={true} without a descriptive aria-label.
  • Do NOT apply CSS gradients or drop shadows to Button.
  • Do NOT render solid crimson background with white text in dark mode (fails contrast at 2.51:1); 'danger' uses outlined --status-error.

Accessibility & Keyboard Contract

Native <button type='button'> defaultaria-busy during async submit without dropping focusRequired aria-label when iconOnly={true}
Keyboard interactions
KeyBehavior
Tab / Shift+TabMoves focus with 2px high-contrast .millar-focus ring.
Enter / SpaceActivates button unless disabled or busy.