Button
Clickable action element.
- Action Button
- Action Link
- Chunky Buttons
- Circular Button
- Button Link
- Button Tile
- Button Timed
- Call to Action Link
- Close Button
- Card Button
- Condensed Button
- Copy Button
- Floating Action Button
- Floatbutton
- Form buttons
- Link button
- Primary Button
- Secondary Button
- Tertiary Button
- Ghost Button
- Icon Button
- Text Button
Overview
Purpose
The Button component clickable action element.within our design system. It follows our primitive layer principles, ensuring consistency and reusability across applications.
When to Use
- Use when you need triggering user interactions
- Appropriate for actions contexts
- Follows primitive component patterns
When Not to Use
- Avoid when simpler alternatives exist
- Don't use for navigation or form submission
- Consider alternatives for edge cases
Live Example
Anatomy
Understanding the structure of the Button component helps ensure proper implementation and customization.
Anatomy data not yet defined for this component. Define anatomy in the component contract file (Button.contract.json).
Variants & States
API Reference
Props
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
size | ButtonSize | No | 'medium' | — |
variant | ButtonVariant | No | 'primary' | — |
loading | boolean | No | false | — |
disabled | boolean | No | false | — |
className | string | No | '' | — |
title | string; // Ensure you have a title prop for accessibility | No | '' | — |
ariaLabel | string | No | — | — |
ariaExpanded | boolean | No | — | — |
ariaPressed | boolean | No | — | — |
role | React.AriaRole | No | — | — |
asChild | boolean | No | false | — |
Accessibility
Standards Compliance
This component follows WCAG 2.1 AA guidelines and includes proper ARIA attributes, keyboard navigation, and screen reader support.
Common Pitfalls
- Overloaded with too many variants
- missing accessible name for icon-only.
Accessibility Checklist
- ○ Keyboard navigation support
- ○ Screen reader compatibility
- ○ Color contrast compliance
- ○ Focus management
- ○ ARIA attributes
- ○ Reduced motion support
Content Guidelines
Voice
Action-oriented, clear, and concise
Tone
Direct and confident
Copy Examples
Save changes
Click here to save your changes
Delete
Remove this item from the list
Sign in
Sign in to your account
UI Copy Patterns
- Use verbs (Save, Delete, Submit)
- Keep labels short (1-2 words)
- Be specific about the action
- Avoid "Click here" or vague instructions
Usage Guidelines
✓ Do
- Use consistent spacing and sizing
- Follow established patterns
- Provide clear labels and descriptions
- Test with assistive technologies
✗ Don't
- Override core functionality
- Use without proper context
- Ignore accessibility requirements
- Modify without design system approval
Examples
Advanced Usage
Complex patterns including composition, state management, and real-world scenarios.
Development Tools
Use these tools to analyze the component's performance, design tokens, and accessibility during development.
Changelog
- changedRenamed `onClick` prop to `onPress` for consistency
- addedAdded `variant` prop with "primary" and "secondary" options
- changedUpdated styling approach to use CSS classes
- addedAdded `isLoading` prop for loading state
- fixedFixed focus styles for keyboard navigation
- addedInitial release of Button component
Migrating from an older version? View migration guide (1.0.0 → 2.0.0)
Contribute
Help us improve the Button component documentation. Found an issue or have suggestions?