Button
Terminal-aesthetic button component built on Base UI for accessibility.
Import
Basic Usage
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'primary' | 'secondary' | 'primary' | Visual style variant of the button |
disabled | boolean | false | Whether the button is disabled and non-interactive |
children* | React.ReactNode | — | Button content (text, icons, or elements) |
className | string | — | Additional CSS class names for custom styling |
onClick | (event: MouseEvent) => void | — | Click event handler |
type | 'button' | 'submit' | 'reset' | 'button' | HTML button type attribute |
ref | React.Ref<HTMLButtonElement> | — | Forwarded ref to the underlying button element |
All standard HTML button attributes are also supported (onFocus, onBlur, aria-*, etc.).
Variants
Primary & Secondary
Primary buttons are for main actions. They have a solid background with inverted text.
Secondary buttons are for auxiliary actions. They have a transparent background with an inset border.
States
Primary States
Secondary States
With Icons
Use terminal-style bracket notation for icons:
Custom Sizes
Apply custom font sizes and padding via style or className:
Interactive Example
0
Full Width
Button Group
Create toggle groups by managing selection state:
Loading State
Implement loading with disabled state and text change:
Accessibility
- Built on Base UI's accessible button primitive
- Supports keyboard navigation (Enter/Space to activate)
disabledattribute properly disables pointer events and keyboard interaction- Focus states are clearly visible with outline
- Works with screen readers
Styling
The Button uses CSS custom properties for theming:
| Variable | Description |
|---|---|
--theme-button | Primary button background |
--theme-button-text | Primary button text color |
--theme-button-background | Secondary button background |
--theme-button-foreground | Secondary button border color |
--theme-focused-border | Focus outline color |
Base UI
This component wraps the Base UI Button primitive. See the Base UI Button documentation for additional details.