# Icon

Supply UI 1.1.0. Helpers.

A `lucide-react` icon in the theme's size and weight: `<Icon icon={Search} />`; give `label` when the icon alone says something

A Lucide icon in the system's size, colour and line weight. Inside a button, menu item or nav item a bare lucide-react icon is styled the same way.

## Options

| Option | Type | Default | What it does |
| --- | --- | --- | --- |
| `icon` (needed) | `ComponentType` |  | An icon from lucide-react: `import { Search } from 'lucide-react'`, then `<Icon icon={Search} />`. |
| `label` | `string` |  | What the icon means, when it stands alone without text. Leave out when text sits next to it. |
| `size` | `"sm" \| "md" \| "lg" \| "xl"` | `'md'` | `md` follows the text size; `lg` and `xl` are fixed sizes for empty states and tiles. |
| `solid` | `boolean` |  | Filled in: the "on" state of a star, a heart, a pin. |

It also takes the 487 attributes of the element or UI SDK part it renders (`className`, `aria-label`, events…).

## CSS parts

With the CSS in parts (`/ui/css/`), it needs: `components/icons.css`, besides the ones every page loads.

## Helpers: notes

Hooks and functions the components are made of, passed on so a project uses the same ones: keyboard shortcuts, options loaded while typing, search matching, saved preferences, screen-reader announcements, smooth sizes, the theme.

**Do**
- Use `useShortcut` for app-wide keys, and show the key with `formatShortcut` so it reads right on each computer.
- Use `announce()` to tell a screen reader what changed when nothing visible takes focus ("3 results").

**Don't**
- Don't turn off the smooth sizes `Toaster` starts; boxes would jump when their content changes.
