# Button
> A button or a component that looks like a button.
[Canonical documentation](https://coss-sv.vercel.app/docs/components/button)
## Installation
## Usage
```svelte
```
## Link
Pass `href` to render a semantic link with the same styles.
```svelte
```
## API Reference
### Button
A button component with variant, size, and loading states. Native attributes pass to the rendered
element.
| Prop | Type | Default | Description |
| ---------- | --------------------------------------------------------------------------------------------------------- | ----------- | ----------------------------------------------------------------- |
| `variant` | `"default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "outline" \| "secondary"` | `"default"` | Controls the button styling |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xl" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` | `"default"` | Controls the button size |
| `loading` | `boolean` | `false` | Shows a spinner and forces disabled button behavior while loading |
| `href` | `string` | — | Renders a semantic link with the button styles |
| `target` | `string` | — | Sets the link browsing context when `href` is present |
| `rel` | `string` | — | Sets the link relationship when `href` is present |
| `download` | `boolean \| string` | — | Downloads the linked resource when `href` is present |
| `as` | `keyof HTMLElementTagNameMap` | `"button"` | Renders a different non-link element |
When `loading` is `true`, the component:
- Renders a spinner (`data-slot="button-loading-indicator"`)
- Adds `data-loading` on the button root
- Forces the native `disabled` attribute for buttons
- Sets `aria-disabled="true"`
- Preserves button width because it keeps the child content mounted and hides it visually
See the [Shards Button API](https://shardsui.com/svelte/button) for keyboard and disabled behavior.
## Examples
### Default
### Outline
### Secondary
### Destructive
### Destructive Outline
### Ghost
### Link
### Extra-small Size
### Small Size
### Large Size
### Extra-large Size
### Disabled
### Icon
### Icon Small Size
### Icon Large Size
### With Icon
### With Link
### Loading (Built-in Prop)
### Loading (Custom Composition)