# Button

The call to action. Solid for the one primary action of a view, outline for the action beside it.

Code: `components/ui/button.tsx`. Figma: CTA Button, node 25:1799. Live: https://design.id-hub.dk/components/button

```tsx
import { Button, buttonClasses } from '@/components/ui/button';

<Button>Tilføj til kurv</Button>
<Button variant="outline">Find forhandler</Button>
<Button icon="arrow-right">Se kollektionen</Button>
<a className={buttonClasses({ variant: 'outline' })} href="/kontakt">Kontakt os</a>
```

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| variant | `'solid' \| 'outline'` | `'solid'` | Solid is filled in the button colour of the theme. Outline is a hairline in the same colour. |
| icon | `IconName` |  | An icon beside the label, by its name in the set. It is 20 px, the line height of the label, and takes the colour of the label. |
| iconPosition | `'before' \| 'after'` | `'after'` | Where the icon sits: before or after the label. |
| ...button | `ButtonHTMLAttributes` |  | Everything a native button takes: onClick, disabled, type (defaults to "button"). |

Do:
- One solid button per view. It is the thing the page wants done.
- Write the label as the action: "Tilføj til kurv", not "OK".
- Use buttonClasses on a link when the action navigates.
- Use an icon only when it adds to the label, such as an arrow on a button that leads onward.

Do not:
- Do not colour a button with Flare. Flare is for the logo only.
- Do not set your own padding, radius or font on it.
- Do not put two solid buttons side by side.
- Do not use a button with an icon and no label. An icon alone is not a call to action.

Accessibility:
- A native button: keyboard and screen reader work without script.
- Focus shows a ring in the text colour. Figma has no focus state yet, so the ring is ours until Peter draws one.

Tokens it uses:
- color.button.solid.fill
- color.button.solid.text
- color.button.outline.stroke
- color.button.outline.text
- radius.sm
- type.button.md
- component.button.padding-x
- component.button.padding-top
- component.button.padding-bottom
- space.inline.1
- icon.size.md
- icon.stroke.md

---

Drawn in Figma: one of the 8 components that may be used anywhere, the public site included. All of them: https://design.id-hub.dk/components.md. Token values: https://design.id-hub.dk/tokens.md.

Index of everything, as text: https://design.id-hub.dk/llms.txt. Never invent a colour, a size, a component or a product fact: if it is not here, it does not exist yet.
