Icon Picker
Searchable Lucide icon grid with arrow-key navigation, roving tabindex, recent icons, and tags search.
Keyboard
- ↑↓←→
- Move through the grid
- HomeEnd
- First or last icon in the row
- PageUpPageDown
- Previous or next section
- EnterSpace
- Pick the focused icon
Installation
The CLI also installs the npm packages and registry items it builds on, and reads the style in your components.json to pick the Base UI or Radix build.
Usage
"use client"
import { useState } from "react"
import { IconPicker } from "@/components/ui/icon-picker"
export function Example() {
const [icon, setIcon] = useState("folder-open")
return (
<IconPicker
value={icon}
onValueChange={setIcon}
aria-label="Choose icon"
/>
)
}Examples
In a popover
IconPicker is an inline panel, so place it in a Popover for a compact icon selector. Selecting an icon updates the state and closes the popover.
Curated icon set
Pass a constrained list of icon names and search tags via icons to restrict choices to category-relevant icons.
API reference
IconPicker
An inline Lucide icon panel with search, roving tabindex, arrow-key navigation, tags search, and recently used icons. Icons load dynamically on demand.
| Prop | Type | Default |
|---|---|---|
valuestringControlled Lucide icon name (e.g. "folder-open"). | string | |
defaultValuestringDefault""Initial uncontrolled Lucide icon name. | string | "" |
onValueChange(value: string) => voidCalled when an icon is selected. | (value: string) => void | |
onSelect(value: string) => voidAlias callback called when an icon is selected. | (value: string) => void | |
icons(string | { name: string; tags?: string[] })[]Optional custom icon subset. Defaults to all Lucide icons. | (string | { name: string; tags?: string[] })[] | |
tagsRecord<string, string[]>Additional search tags keyed by icon name. | Record<string, string[]> | |
columnsnumberDefault6Number of columns in the icon grid. | number | 6 |
maxRecentnumberDefault16Maximum number of recently used icons to preserve. | number | 16 |
storageKeystringDefault"drift-ui:icon-picker"localStorage key for persisting recently used icons. | string | "drift-ui:icon-picker" |
Other props go to the <div>.
searchIcons
searchIcons(icons: IconItem[], query: string, customTags?: Record<string, string[]>): IconItem[]Pure logic helper in @/lib/icon-picker-utils that matches query against icon names, hyphenated segments, and tags.