# Button
A versatile button component with multiple variants and sizes, built with Class Variance Authority (CVA) for consistent styling.
## Features
- **Multiple variants**: Primary, secondary, outline, ghost, and destructive
- **Three sizes**: Small, medium, and large
- **Accessibility**: Focus states and disabled states
- **TypeScript**: Fully typed with proper prop interfaces
- **CVA Integration**: Dynamic styling with variant props
## Variants
### Primary
The default button style with blue background.
```tsx
```
### Secondary
A subtle button with surface background.
```tsx
```
### Outline
A button with border and transparent background.
```tsx
```
### Ghost
A minimal button with no background.
```tsx
```
### Destructive
A button for destructive actions with red styling.
```tsx
```
## Sizes
### Small
```tsx
```
### Medium (Default)
```tsx
```
### Large
```tsx
```
## Props
| Prop | Type | Default | Description |
| ----------- | ------------------------------------------------------------------- | ----------- | ---------------------- |
| `children` | `React.ReactNode` | - | Button content |
| `variant` | `"primary" \| "secondary" \| "outline" \| "ghost" \| "destructive"` | `"primary"` | Button style variant |
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Button size |
| `onClick` | `() => void` | - | Click handler |
| `disabled` | `boolean` | `false` | Disabled state |
| `type` | `"button" \| "submit" \| "reset"` | `"button"` | HTML button type |
| `className` | `string` | `""` | Additional CSS classes |
## Examples
### Form Submit Button
```tsx
```
### Disabled Button
```tsx
```
### Custom Styling
```tsx
```
### Event Handling
```tsx
```
## Accessibility
The Button component includes proper accessibility features:
- **Focus states**: Visible focus ring with `focus-visible:ring-2`
- **Disabled states**: Proper disabled styling and pointer events
- **Keyboard navigation**: Full keyboard support
- **Screen readers**: Proper semantic HTML button element
## Styling
The component uses Tailwind CSS with Catppuccin color palette:
- **Primary**: `bg-ctp-blue` with hover states
- **Secondary**: `bg-ctp-surface1` with subtle hover effects
- **Outline**: Border with `border-ctp-surface1`
- **Ghost**: Transparent with hover background
- **Destructive**: `bg-ctp-red` for dangerous actions
## CVA Configuration
The button variants are defined using Class Variance Authority:
```typescript
const buttonVariants = cva("base-styles", {
variants: {
variant: {
/* variant styles */
},
size: {
/* size styles */
},
},
defaultVariants: {
variant: "primary",
size: "md",
},
});
```
This ensures consistent styling and easy customization across the application.