Button
Buttons are widgets that trigger various actions like opening a dialog, confirming an action, or initiating a delete operation. They can contain text, icons, or both, and are clicked or tapped to execute the desired action.
Code Editor
Features
Supports different variants
Can contain text, , , or both
leftIcon
rightIcon
Supports , state and
loading
disabled
tone
Accepts ButtonGroup as a parent component
Supports different shapes and sizes
Assigns the correct HTML tag
Reference Links
ARIA design pattern
Anatomy
Import all parts and combine them together.
import { Button } from '@vortex-kit/vortex';
import type { ButtonProps } from '@vortex-kit/vortex';
<Button onClick={() => {}} variant="primary" size="lg">
Button
</Button>
Variants
Buttons come in three variants: , , and . The primary variant is used for the most important actions, while the secondary and tertiary variants are used for less important actions.
primary
secondary
tertiary
Code Editor
Sizes
Buttons are available in three sizes: , , and . The default size is .
sm
md
lg
md
Code Editor
Buttons can adapt their responsively according to the breakpoint.
size
Code Editor
Shapes
Buttons have two shapes: and . The shape is .
rounded
default
default
square
Code Editor
Full Width
Buttons can be made full width by setting the property to . Or you can set it responsively according to the breakpoint.
fullWidth
true
Code Editor
States
Buttons have two states: and . The loading state is used when the button is waiting for an action to complete. The disabled state is used when the button is not available for interaction.
loading
disabled
Code Editor
Tones
Currently, the button has one tone: . It is used for the most important actions.
critical
Code Editor
Composition
Buttons can be composed with other components to create complex UI elements using a compound component approach.
Button Group
Button.Group
Code Editor
Button Aligner
Button.Aligner
string
array
Code Editor
Accessibility
Buttons follow the WAI-ARIA Button design pattern and employ appropriate ARIA attributes to ensure accessibility and manage focus behavior for various button types.
Keyboard Interactions
Key | Description |
---|---|
! |
aria-label
|
Enter Space | Pressing
Enter
Space
|