IconPicker
Components

IconPicker

Choose and search icons from the default palette or a custom set.

Props

IconPickerProps props
PropTypeDefaultDescription
valuestring | null—Controlled selected icon name.
defaultValuestring | nullnullInitial uncontrolled selection.
onChange(name: string | null, option: IconPickerOption | null) => void—Called with the selected ID and resolved option.
iconsIconPickerOption[]DEFAULT_ICON_OPTIONSPalette to choose from. Spread DEFAULT_ICON_OPTIONS in to extend rather than replace.
filter(option: IconPickerOption, query: string) => boolean—Replaces the built-in name/label/keyword substring match.
colorColorToken | string"fg"Color applied to the trigger's and the grid's icons.
placeholderstring"Search icons…"Search input placeholder.
emptyMessagestring"No icons found"Shown when a search matches nothing.
clearablebooleantrueLets the trigger clear back to no icon.
flatbooleanfalseHides the sticky section headers and renders one flat grid.
disabledboolean—Prevents interaction.
size"sm" | "md""md"Trigger size.
align"start" | "end""start"Popover alignment.

IconPickerOption

IconPickerOption props
PropTypeDefaultDescription
namestring—Stable identifier used by value and onChange.
iconIconComponent—A Tabler/Lucide-style icon or your own SVG component.
labelstringnameShown in the panel's name readout and matched by search.
keywordsstring[]—Extra terms matched by search, beyond name/label.
categorystring—Section heading for the icon. Options without a section appear in one unlabeled group.

Specimens

Basic

The default palette: DEFAULT_ICON_OPTIONS, ~60 general-purpose glyphs in ten sections (Files, Labels, Media, Development, Business, …). Search filters by label, id, keywords and section name; arrow keys move a cell or a row at a time, and the footer names whichever glyph is under the cursor.

IconPicker

Custom icons

Pass icons to swap in your own set. Each option is { name, icon, label?, keywords?, category? }; icon takes a Tabler component, a Lucide component, or your own SVG, the same as every other icon prop in Onset. Spread DEFAULT_ICON_OPTIONS in first to extend the built-ins instead of replacing them, and give the additions their own category so they land in their own section rather than in the unlabeled one at the top.

IconPicker: custom icons

Flat grid

flat drops the section headers. Use it for a short palette, where the headers cost more vertical space than the grouping buys back.

IconPicker: flat

Folder/tag organizer

A typical use: an icon on a tag or folder row, sized down and not clearable since the row always needs one.

IconPicker: tag row

Import

ImportTSX
import { IconPicker, DEFAULT_ICON_OPTIONS } from "@solarius/onset";