Buttons
Interactive button components with multiple variants, sizes, and states for user actions.
Primary Buttons
Use primary buttons for the main action in a section or form. Limit to one primary button per view.
Secondary Buttons
Use secondary buttons for less prominent actions. They can be paired with primary buttons.
Danger Buttons
Use danger buttons for destructive actions like delete or remove. Always confirm destructive actions.
Button Sizes
Different button sizes for various contexts. Use consistently within the same interface.
Icon Buttons
Icon-only buttons for compact interfaces. Always include proper aria-labels for accessibility.
Loading States
Show loading states during async operations to provide user feedback.
Full Width Buttons
Full width buttons work well in narrow containers or mobile interfaces.
Button Groups
Related buttons can be grouped together with connected borders.
Horizontal Group
Vertical Group
Accessibility Guidelines
✓ Do
- Use descriptive button text that explains the action
-
Include
aria-labelfor icon-only buttons - Provide sufficient color contrast (4.5:1 ratio minimum)
- Ensure buttons are at least 44x44 pixels for touch targets
-
Use proper button semantics (
<button>element) - Include focus indicators for keyboard navigation
- Use loading states for async operations
✗ Don't
- Use vague labels like "Click here" or "Submit"
- Create buttons smaller than 44x44 pixels
- Remove focus indicators without providing alternatives
- Use disabled buttons without explaining why
- Make destructive actions too easy to trigger accidentally
- Use div or span elements as buttons without proper ARIA
Usage Guidelines
When to Use
- Primary: Main action in a section (save, submit, next)
- Secondary: Secondary actions (cancel, previous, edit)
- Danger: Destructive actions (delete, remove, clear)
- Icon: Space-constrained interfaces, toolbars
- Loading: During async operations to show progress
Button Hierarchy
- Use only one primary button per section
- Place primary buttons on the right in button groups
- Use secondary buttons for alternative actions
- Group related actions together
- Maintain consistent sizing within the same context
Dark Mode Support
All button components automatically adapt to dark mode using CSS custom properties and Tailwind's dark mode classes.