<!-- generated by scripts/gen-docs.mjs from docs/system/icons.md. Edit the source and rerun. -->
# Icons

## Description

Icons come from Hugeicons' free Stroke Rounded set on a 24px grid. `icon.tsx` wraps every icon the system uses, named for what it means. Use `size-4` inside a button or a row and `size-5` in a nav link.

## Tokens

Stroke weight comes from `--line-icon` (1.5px), kept constant on screen at every size. Size comes from the spacing scale. Colour is `currentColor`.

## Specimens

None yet.

## Usage

| When                       | Use                                                                              |
| -------------------------- | -------------------------------------------------------------------------------- |
| Inside a Button            | the icon as a child. Button sizes it to `size-4`.                                |
| A button with only an icon | `IconButton` with `label`. The label is the accessible name and the tooltip.     |
| A nav link                 | `size-5`. The phone tab bar uses `size-5.5` with the same `--line-icon` stroke. |
| An icon beside text        | `aria-hidden`                                                                    |

- `rule/icons-from-the-barrel`: When a component needs an icon, import it from `@/components/cobalt/icon`, because one file keeps the set consistent and lets you swap a glyph in one place. Evidence: app 2/2 source apps route every icon through one file, tsaglobal apps/web/app/components/icons.tsx and adv-atlas web/icons.tsx. Check: lint rule/ban-icon-import once added; review of imports.
  - Don't: `import { Cancel01Icon } from "@hugeicons/core-free-icons"`
  - Do: `import { XIcon } from "@/components/cobalt/icon"`
- `rule/icons-named-for-meaning`: When adding an icon to `icon.tsx`, name the export for what it does here, such as `MoreIcon`, `SortIcon` or `VerifiedIcon`, because then you can change the glyph without renaming every import. Evidence: principle heuristic: consistency and standards, one name per meaning lets a glyph change without touching its uses; single use docs/research/2026-10-16-findings.md:46, the first source app's barrel names every export by meaning. Check: review of icon.tsx.
  - Don't: `export { MoreVerticalIcon } from "@hugeicons/core-free-icons"`
  - Do: `export const MoreIcon = createIcon(MoreVerticalGlyph, "more")`
- `rule/icons-not-on-every-label`: When a `DropdownMenuItem` or a row has a text label, leave out the icon unless users find the action by its shape, because icons on every label make each one harder to spot. Evidence: principle heuristic: aesthetic and minimalist design, each extra glyph makes the others harder to spot; person D11. Check: review.
  - Don't: `<DropdownMenuItem><PencilIcon /> Edit</DropdownMenuItem> <DropdownMenuItem><TrashIcon /> Delete</DropdownMenuItem>`
  - Do: `<DropdownMenuItem>Edit</DropdownMenuItem> <DropdownMenuItem variant="destructive">Delete</DropdownMenuItem>`

## Accessibility

An icon beside text is `aria-hidden`. An icon on its own takes its accessible name from its button's `aria-label`, which `IconButton` also shows as the tooltip. The contrast of a 16px icon against its background has not been measured yet. A state shown by an icon also needs text or an accessible name.

## Not tokens

- The 24px grid is Hugeicons' drawing grid. The icon library is replaceable behind the semantic exports.
