ELFBAR

Button

Buttons trigger actions or submit forms, supporting 8 visual variants and 4 sizes.

Stable

Buttons trigger actions or submit forms. Choose the appropriate button type based on the importance of the action to maintain clear visual hierarchy.

Anatomy

A button is composed of:

  1. Container — Defines the button boundary and background, supports multiple corner sizes (cornerSize)
  2. Label — Button text, single line, no wrapping
  3. Icon — Optional, placed to the left or right of the label with ele-sm spacing
  4. State Layer — Background color transition on hover/press

Usage Guidelines

Do ✓

  • Use Brand Button 1 or Primary to highlight the most important action on a page
  • Place only one primary action button per view
  • Start button labels with a verb (e.g. "Add to cart", "Submit order")
  • Use the Error button for destructive actions, paired with a Confirmation Dialog

Don't ✗

  • Don't place multiple Primary or Brand buttons on the same row
  • Don't use buttons for page navigation (use links instead)
  • Don't omit button text (use Icon Button for icon-only scenarios)
  • Don't use overly long button labels (recommended ≤ 3 words)

Interaction Behavior

InteractionBehavior
Click / TouchTriggers the associated action, visually switches to Activated state
HoverBackground color transitions to hover state in 150ms ease
Keyboard Enter / SpaceTriggers click event
Keyboard TabFocuses button, shows focus ring
Disabledpointer-events: none, gray background

Accessibility

RequirementDetails
Semantic roleUse native <button> element
Disabled stateUse disabled attribute
ContrastText-to-background contrast ≥ 4.5:1
Focus orderFollows DOM order, supports Tab navigation