The Button Group component provides an elegant way to group related buttons together with consistent spacing and visual connection. Perfect for navigation, toolbars, and multi-step forms.
Installation
Examples
Default Size
Small Size with Icons
Large Size with Separation
Icon Only
Usage
Basic Usage
With Icons
Customization
Different Sizes
Separated Buttons
Custom Styling
Notes
- Built with class-variance-authority for type-safe variants
- Responsive design with mobile-first approach
- Supports all button variants from Shadcn UI
- Maintains proper focus states and accessibility
- Handles touch devices with appropriate spacing
- Supports vertical stacking on mobile
- TypeScript support with proper types
- Customizable through Tailwind classes
Features
- Multiple size variants
- Optional button separation
- Icon-only mode support
- Responsive layout
- Mobile-friendly design
- Focus management
- Keyboard navigation
- Consistent spacing
Props
Prop | Type | Description |
---|---|---|
size | "default" | "sm" | "lg" | "icon" | The size of the button group |
separated | boolean | Whether to add spacing between buttons |
className | string | Additional CSS classes |
children | React.ReactNode | The buttons to be grouped |