# Button

> The primary action control, with variants and sizes.

- Category: [Actions & feedback](https://tarve.dev/docs.md#actions)
- Import: `import { Button } from "@tarve/core";`
- Props type: `ButtonProps`
- Source: [packages/core/src/components/button.ts:129](https://github.com/omarcosr/tarve/blob/main/packages/core/src/components/button.ts#L129)

## Usage

```tsx title="Button.tsx"
import { Button, Icon, Row } from "@tarve/core";

<Row gap={8}>
  <Button onClick={() => console.log("saved")}>Save</Button>
  <Button variant="outline">Cancel</Button>
  <Button variant="ghost" size="sm">
    <Icon name="plus" />
    New
  </Button>
  <Button variant="destructive" disabled>Delete</Button>
</Row>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `control` | `Control` | — |  |
| `disabled` | `boolean` | — |  |
| `glass` | `GlassProp` | — | Liquid Glass capsule: `true`, a variant or options. `destructive` tints it red, `ghost` is clear glass without a shadow, `glass={{ tint }}` makes a prominent coloured one. |
| `onClick` | `() => void` | — |  |
| `onHover` | `(hovered: boolean) => void` | — |  |
| `size` | `"sm" \| "default" \| "lg"` | `"default"` |  |
| `variant` | `ButtonVariant` | `"default"` |  |

## Common props

Shared by every component (descriptions: https://tarve.dev/docs.md#common-props): `children`, `class`, `className`, `highlight`, `id`, `key`, `motionFrom`, `onHighlight`, `onPaste`, `onPointerLeave`, `onPointerMove`, `onSize`, `onTransitionEnd`, `rovingGroup`, `style`.

## Types

```ts title="ButtonVariant"
type ButtonVariant = "default" | "secondary" | "outline" | "ghost" | "destructive";
```

```ts title="GlassProp"
type GlassProp = boolean | GlassVariant | GlassOptions;
```

Previous: [DatePicker](https://tarve.dev/docs/components/DatePicker.md) · Next: [ButtonGroup](https://tarve.dev/docs/components/ButtonGroup.md)

---

Tarve v0.13.8 · HTML version: https://tarve.dev/docs/components/Button · Index for agents: https://tarve.dev/llms.txt
