Icon
An icon from the Figma set, treated as part of the text: 1.5 times the text size, stroke 1/12 of the text size, in the text colour.
In Figma: Icon (node 57:629). In code: components/ui/icon.tsx
Example
På lager
import { Icon } from '@/components/ui/icon';
<Icon name="search" />
<button aria-label="Luk"><Icon name="x" /></button>
<Icon name="check" label="På lager" />Props
| Prop | Type | Default | What it does |
|---|---|---|---|
name (required) | IconName | One of the icons in icons/icons.json. The set is closed. | |
label | string | What the icon says when it stands alone. Without it the icon is hidden from screen readers. |
Do
- Set the size by the text size around the icon.
- Add a new icon in Figma first, then export it to icons/svg and add it to icons/icons.json.
Do not
- Do not paste an svg into a page. Use the name.
- Do not use filled icons or icons from another set.
- Do not let an icon be the only carrier of meaning: status has text beside it.
Accessibility
- Decorative by default. With label it is announced as an image with that name.
Tokens it uses
- icon.stroke
- icon.scale
- component.icon.grid