ActionButton
Terminal-style action button with hotkey display, inspired by classic file managers.
Import
Basic Usage
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'primary' | 'secondary' | 'primary' | Visual style variant |
hotkey | string | — | Hotkey label displayed before the action text (e.g., "F1", "^S") |
disabled | boolean | false | Whether the button is disabled |
children* | React.ReactNode | — | Action label text |
className | string | — | Additional CSS class names |
onClick | (event: MouseEvent) => void | — | Click event handler |
ref | React.Ref<HTMLButtonElement> | — | Forwarded ref to the button element |
Variants
All Variants
Primary - Default style for standard actions.
Secondary - Subdued style for less prominent actions.
States
Default States
All Variants Disabled
With Hotkeys
Display keyboard shortcuts using the hotkey prop:
Hotkey Conventions
| Format | Example | Usage |
|---|---|---|
F1-F12 | hotkey="F1" | Function keys |
^X | hotkey="^S" | Ctrl+Key (caret notation) |
A-Z | hotkey="S" | Single letter shortcuts |
1-9 | hotkey="1" | Number keys |
Interactive Example
Click an action
Custom Sizes
Accessibility
- Built on Base UI's accessible button primitive
- Hotkeys are displayed visually but not automatically bound
- Use a keyboard event listener to implement actual hotkey functionality
- Supports keyboard navigation with Enter/Space
- Clear focus states for keyboard users
Usage with ActionBar
ActionButton is designed to be used inside ActionBar for toolbar-style layouts:
Styling
| Variable | Description |
|---|---|
--theme-button | Primary button background |
--theme-button-text | Primary button text |
--theme-button-background | Secondary button background |
--theme-focused-border | Focus outline color |