# Button

A button that does something on this page. `variant` sets how much emphasis it claims — one `primary` per view, `secondary` by default, `tertiary` for the quietest, `destructive` for a dangerous action. It hugs its label; `fullWidth` fills the container. With `href` it renders a link instead, for an action that goes somewhere — Sign up, Try the demo.

```tsx
import { Button } from "@dede-style/ui"
```

## Props

| Prop | Values | Default | Description |
|---|---|---|---|
| `variant` | `primary` · `secondary` · `tertiary` · `destructive` | `secondary` | emphasis: primary for the main action (one per view), secondary (default), tertiary for the quietest, destructive for a dangerous action |
| `size` | `6` · `8` · `10` · `12` | `10` | height: 24, 32, 40 or 48px. 24 is for icon buttons only. In code it can change by breakpoint, as Stack’s lanes: { base: 12, md: 10 }, measured against the Section |
| `shape` | `rounded` · `pill` · `square` | `rounded` | corners: rounded (default), pill or square |
| `glyph` | `none` · `Alert` · `AlertFill` · `ArrowDown` · `ArrowLeft` · `ArrowRight` … ([all](https://dede.style/icons)) | `none` | an optional icon beside the label. In code, import it by its full name: icon plus this (Star is iconStar) |
| `iconPosition` | `start` · `end` | `start` | which side of the label the icon sits on |
| `glyphSize` | `auto` · `3` · `4` · `5` · `6` | `auto` | the glyph’s size: 3, 4, 5 or 6 (12, 16, 20 or 24px), Icon’s sizes that fit inside a button. Auto (the default) is half the button’s height at every width. In code, leave it out for auto. In code it can change by breakpoint too, as size |
| `isDisabled` | `true` · `false` | `false` | disables the button and dims it |
| `fullWidth` | `true` · `false` | `false` | fill the container's width. Off, the button fits its label |
| `type` | `button` · `submit` · `reset` | `button` | the HTML button type. Default button, so it never submits a form by accident; use submit to submit |

Also takes `children`, `onClick`, `className`, `style`, `aria-expanded` and `aria-controls`. Any other prop is not passed to the page. Sizes are `--size-element-*` steps: `6` = 24px, `8` = 32px, `10` = 40px and `12` = 48px.

## Notes

- **Links**: give `href` and Button renders an `<a>` with the button's look, for an action that goes somewhere (Sign up, Get started). `onClick` still runs. In Next.js, add `linkAs={Link}` (from `next/link`) so the page changes without a full reload: `<Button href="/start" linkAs={Link}>Get started</Button>`. IconButton takes `href` and `linkAs` too. A link in running text stays a plain `<a>`.
- **Hover** shows only where the pointer can hover. On a touch screen a tap does not leave the button lit; the press state still shows.
- **Motion**: it grows a little on hover (`--motion-scale-hover`, 1.02) and shrinks a little when pressed (`--motion-scale-press`, 0.97). Set either token on `:root` for every button, or in your own class for one. With reduced motion on, it does not grow or shrink. More in DESIGN.md, Motion.
- **Pausing hover after a click**: when a click changes what the button does but the pointer stays on it (a next arrow), set `isHoverPaused` from your own state on click and clear it when the pointer leaves. While paused there is no fill change and no grow; pressed and focus still show. Not for turning hover off for good. IconButton takes `isHoverPaused` too.

Live examples: https://dede.style/components/button

_Generated from the component's schema by `npm run build:docs`._
