Components · Form Controls
Icon Picker
Pick an icon from @nexub/icons in a searchable grid with recent picks and optional categories. A popover, a bottom sheet on phones.
import { IconPicker } from '@nexub/react';Usage
An icon for a space, doc, category or saved view.
The value is the icon’s export name, so it can be stored and drawn later.
An emoji: use EmojiPicker.
Icons outside @nexub/icons: build a grid of your own.
Playground
Props
<IconPicker aria-label="Menu icon" value={icon} onValueChange={setIcon} />Examples
Default
Categories
States
States
defaultdisabledinvalidreadOnlysize="sm"size="md"size="lg"
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | — | The picked icon’s export name, e.g. "CalendarDays". null for none. |
| defaultValue | string | null | The picked icon’s export name, e.g. "CalendarDays". null for none. |
| onValueChange | ((name: string) => void) | — | Called with the picked name. The picker closes. |
| icons | string[] | every `@nexub/icons` export, A–Z | Only these icons, in this order. Default: every @nexub/icons export, A–Z. |
| categories | IconPickerCategory[] | — | Icons under headings, with a row of buttons to jump between them. Overrides icons. |
| placeholder | string | messages.pickIcon | Shown on the trigger when nothing is picked. |
| recent | string[] | — | Recent picks, newest first. Unset: the last 16 picks are kept in localStorage (nx-icon-recent). |
| name | string | — | A hidden input posts the value with a plain form. |
| disabled | boolean | — | Field states, as on Select. Read-only stays focusable and does not open. |
| readOnly | boolean | — | Field states, as on Select. Read-only stays focusable and does not open. |
| invalid | boolean | — | Field states, as on Select. Read-only stays focusable and does not open. |
| required | boolean | — | Field states, as on Select. Read-only stays focusable and does not open. |
| size | 'sm' | 'md' | 'lg' | 'md' | Height of the trigger. |
| sheet | false | true | 'auto' | 'auto' (a bottom sheet below 768px) | The grid as a bottom sheet below 768px. |
| IconPicker.Panel | component | — | The grid alone (value, onValueChange, icons, categories, recent, autoFocus), for any popover or page. |
| aria-describedby | string | — | |
| aria-invalid | false | true | 'true' | 'false' | — | |
| aria-label | string | — | |
| aria-labelledby | string | — | |
| aria-required | false | true | 'true' | 'false' | — | |
| className | string | — | |
| id | string | — |
Accessibility
ARIA roles
Keyboard
- Enter / Space / Arrow Down
On the trigger: opens the picker with focus in the search box.
- Arrow Down
From the search box: into the grid.
- Arrow keys
Move between icons; Arrow Up from the first row returns to the search box.
- Home / End
First or last icon in the row; with Ctrl, in the whole list.
- Enter / Space
Picks the focused icon. Enter in the search box picks the first result.
- Escape
Closes without changing the value.
Notes
Each icon is named from its export name ("ArrowUpRight" reads "Arrow up right").
The icon set is loaded with a dynamic import when the picker opens or shows a value.