Skip to content
nexubDesign System
v11.9.0

Components · Form Controls

Icon Picker

AlphaAdded v11.2.0

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';
View as Markdown

Usage

Use it for
  • 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.

Use something else for
  • An emoji: use EmojiPicker.

  • Icons outside @nexub/icons: build a grid of your own.

Playground

Props

size
TSX
<IconPicker aria-label="Menu icon" value={icon} onValueChange={setIcon} />

Examples

Default

Categories

States

States

  • default
  • disabled
  • invalid
  • readOnly
  • size="sm"
  • size="md"
  • size="lg"

Props

Props
PropTypeDefaultDescription
valuestring—The picked icon’s export name, e.g. "CalendarDays". null for none.
defaultValuestringnullThe picked icon’s export name, e.g. "CalendarDays". null for none.
onValueChange((name: string) => void)—Called with the picked name. The picker closes.
iconsstring[]every `@nexub/icons` export, A–ZOnly these icons, in this order. Default: every @nexub/icons export, A–Z.
categoriesIconPickerCategory[]—Icons under headings, with a row of buttons to jump between them. Overrides icons.
placeholderstringmessages.pickIconShown on the trigger when nothing is picked.
recentstring[]—Recent picks, newest first. Unset: the last 16 picks are kept in localStorage (nx-icon-recent).
namestring—A hidden input posts the value with a plain form.
disabledboolean—Field states, as on Select. Read-only stays focusable and does not open.
readOnlyboolean—Field states, as on Select. Read-only stays focusable and does not open.
invalidboolean—Field states, as on Select. Read-only stays focusable and does not open.
requiredboolean—Field states, as on Select. Read-only stays focusable and does not open.
size'sm' | 'md' | 'lg''md'Height of the trigger.
sheetfalse | true | 'auto''auto' (a bottom sheet below 768px)The grid as a bottom sheet below 768px.
IconPicker.Panelcomponent—The grid alone (value, onValueChange, icons, categories, recent, autoFocus), for any popover or page.
aria-describedbystring—
aria-invalidfalse | true | 'true' | 'false'—
aria-labelstring—
aria-labelledbystring—
aria-requiredfalse | true | 'true' | 'false'—
classNamestring—
idstring—

Accessibility

ARIA roles

combobox (trigger)listbox with a group per sectionoption

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.

On iOS & Android