Button Components
Comprehensive guide to button components in Infinibay's frontend
Button Components
Infinibay's frontend provides a comprehensive set of button components built with React and styled with Tailwind CSS.
Overview
Buttons are fundamental UI components used throughout the application. All button components are located in src/components/ui/ and follow consistent design patterns.
Button Variants
Primary Button
Used for primary actions:
<Button variant="primary" onClick={handleSubmit}>
Create VM
</Button>
Secondary Button
Used for secondary actions:
<Button variant="secondary" onClick={handleCancel}>
Cancel
</Button>
Danger Button
Used for destructive actions:
<Button variant="danger" onClick={handleDelete}>
Delete VM
</Button>
Button Sizes
Buttons come in three sizes:
- Small - Compact buttons for tight spaces
- Medium - Default size for most use cases
- Large - Prominent buttons for primary CTAs
<Button size="small">Small</Button>
<Button size="medium">Medium</Button>
<Button size="large">Large</Button>
Loading State
Buttons can display a loading state:
<Button loading={isLoading} onClick={handleSubmit}>
{isLoading ? 'Creating...' : 'Create VM'}
</Button>
Icon Buttons
Buttons can include icons:
<Button icon={<PlusIcon />} onClick={handleAdd}>
Add New
</Button>
Accessibility
All buttons include proper ARIA attributes:
aria-labelfor icon-only buttonsaria-disabledfor disabled statearia-busyfor loading state- Keyboard navigation support
Best Practices
- Use primary buttons sparingly (one per screen section)
- Always provide clear, action-oriented labels
- Show loading state for async operations
- Disable buttons to prevent duplicate submissions
- Use danger variant only for destructive actions