# Rokkit Button Component > Versatile button component with variants, icons, and accessibility support. The Button component provides a flexible, accessible button with support for multiple variants, left/right icons, and custom content through snippets. ## Quick Start ```svelte ``` ### Custom Content Use children snippet for full control: ```svelte ``` ## Props | Prop | Type | Default | Description | |------|------|---------|-------------| | `label` | `string` | `null` | Button text | | `variant` | `string` | `'default'` | Visual variant | | `type` | `string` | `'button'` | HTML button type | | `leftIcon` | `string \| Snippet` | `null` | Icon on left side | | `rightIcon` | `string \| Snippet` | `null` | Icon on right side | | `disabled` | `boolean` | `false` | Disables the button | | `description` | `string` | `null` | Aria-label override | | `class` | `string` | `''` | CSS class names | | `children` | `Snippet` | `null` | Custom button content | | `onclick` | `function` | `undefined` | Click handler | ### Variant Options | Variant | Use Case | |---------|----------| | `'default'` | Standard actions | | `'primary'` | Main call-to-action | | `'secondary'` | Alternative actions | | `'tertiary'` | Low-emphasis actions | ### Type Options | Type | Use Case | |------|----------| | `'button'` | Standard button (default) | | `'submit'` | Form submission | | `'reset'` | Form reset | ## Component Structure ``` ``` ## Data Attributes for Styling | Attribute | Element | Purpose | |-----------|---------|---------| | `data-button-root` | button | Main button element | | `data-variant` | button | Current variant | | `data-disabled` | button | Disabled state | ### Styling Example ```css [data-button-root] { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 6px; font-weight: 500; cursor: pointer; transition: background 0.2s, transform 0.1s; } [data-button-root]:active { transform: scale(0.98); } [data-button-root][data-disabled="true"] { opacity: 0.5; cursor: not-allowed; } /* Variants */ [data-button-root][data-variant="default"] { background: var(--surface-100); color: var(--surface-900); border: 1px solid var(--border-color); } [data-button-root][data-variant="primary"] { background: var(--primary-500); color: white; border: none; } [data-button-root][data-variant="secondary"] { background: var(--secondary-500); color: white; border: none; } [data-button-root][data-variant="tertiary"] { background: transparent; color: var(--primary-600); border: none; } [data-button-root][data-variant="primary"]:hover { background: var(--primary-600); } ``` ## Accessibility - Uses native ` ``` ### Button Group ```svelte
``` ## Related Components - **Icon** - Icon rendering used in buttons - **Toggle** - For boolean toggle actions - **FloatingAction** - Floating action buttons