IconPicker

A compound component for selecting icons from Lucide React with search, preview, and optimized rendering.

Installation

CLI

Dependencies

This component requires the following npm packages:

Registry Dependencies

This component also requires: button, dialog, input, utils

Usage

IconPicker is a compound component for selecting icons from the Lucide React icon library. It provides a searchable dialog interface with real-time preview and optimized rendering for large icon lists.

The component uses a compound component pattern, allowing you to customize the trigger, content, and preview independently. It supports both controlled and uncontrolled usage patterns.

Examples

Controlled State

Control both the icon value and dialog open state for more advanced use cases.

With Custom Color

Set a custom background color for the icon preview in the dialog.

Custom Trigger

Use any element as a trigger by wrapping it with IconPickerTrigger.

API Reference

IconPicker Props

PropTypeDefaultDescription
valuestring-The controlled value of the selected icon name (kebab-case).
defaultValuestring"folder-kanban"The default value of the selected icon name.
onValueChange(value: string) => void-Callback fired when the icon selection changes.
openboolean-The controlled open state of the dialog.
defaultOpenbooleanfalseThe default open state of the dialog.
onOpenChange(open: boolean) => void-Callback fired when the dialog open state changes.
colorstring-Background color for the icon preview (CSS color value).
disabledboolean-Whether the icon picker is disabled.
children*ReactNode-The trigger element and dialog content.

IconPickerTrigger Props

PropTypeDefaultDescription
children*ReactNode-The trigger element (usually a Button).
...propsDialogTriggerProps-All DialogTrigger props are supported. Note: asChild is always set to true internally.

IconPickerContent Props

PropTypeDefaultDescription
titlestring"Select Icon"The title of the dialog.
descriptionstring"Choose any icon from Lucide."The description text shown in the dialog header.

IconPickerPreview Props

PropTypeDefaultDescription
sizenumber24The size of the preview icon in pixels.

Source Code