# UtilityButton

A quiet control on glass, for navigation and tools on top of an image or a coloured ground.

Code: `components/ui/utility-button.tsx`. Figma: Utility Button, node 2125:92. Live: https://design.id-hub.dk/components/utility-button

```tsx
import { UtilityButton } from '@/components/ui/utility-button';

<UtilityButton dropdown aria-expanded={open} onClick={toggle}>Find forhandler</UtilityButton>
<UtilityButton size="sm" icon="search" iconPosition="before">Søg</UtilityButton>
```

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| dropdown | `boolean` | `false` | Shows the chevron that says the button opens a list. Set aria-expanded with it. |
| size | `'md' \| 'sm'` | `'md'` | Medium is 36 px high with Body/md and a 20 px icon. Small is 28 px high with Body/sm and a 16 px icon. |
| icon | `IconName` |  | An icon beside the label, by its name in the set. With dropdown it is the chevron. |
| iconPosition | `'before' \| 'after'` | `'after'` | Where the icon sits: before or after the label. |
| ...button | `ButtonHTMLAttributes` |  | Everything a native button takes. |

Do:
- Use it on an image or a coloured ground, where the glass has something to blur.
- Set data-theme="dark" on a dark ground so the text turns white.

Do not:
- Do not use it as the call to action. That is Button.
- Do not use it on a plain white page: 5 % glass on white is nearly invisible.

Accessibility:
- With dropdown, set aria-expanded so a screen reader hears whether the list is open.

Tokens it uses:
- color.surface.glass
- color.text.default
- radius.sm
- space.inline.1
- space.inline.2
- space.inline.3
- type.body.md
- component.utility-button.blur
- type.body.sm
- component.utility-button.small-padding-x
- component.utility-button.small-padding-y
- icon.size.md
- icon.size.sm
- icon.stroke.md
- icon.stroke.sm

---

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.
