A field plugin for Payload CMS v4 that lets editors pick icons from any icon pack, such as react-icons or lucide-react, through a searchable dropdown or a sliding drawer grid. The selected icon name and raw SVG are saved as JSON, so the frontend needs no icon library. It can add fields to collections automatically or be used via an iconField helper. It is a fork of an earlier plugin and requires exactly payload 4.0.0-beta.10.
A dynamic icon picker field plugin for Payload CMS v4 supporting custom icon packs, searching, and custom SVG rendering.
Installation
npm i @kristianpennacchia/payload-icon-picker0
Stars
0
Forks
0
Open Issues
1 weeks ago
Last Updated
34
Weekly Downloads
v1.5.12-payload-v4.3
npm Version
112.5 KB
Unpacked Size
3
Dependencies
00 since Nov 22
| Date | Stars |
|---|---|
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
| Nov 28, 2026 | 0 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
42+42 since Nov 25
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 42 |
| Dec 4, 2026 | 62 |
| Dec 3, 2026 | 250 |
| Dec 2, 2026 | 249 |
| Dec 1, 2026 | 244 |
| Nov 30, 2026 | 237 |
| Nov 29, 2026 | 227 |
| Nov 28, 2026 | 219 |
| Nov 27, 2026 | 193 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1469528735-root)<a href="https://payloaddirectory.dev/plugins/1469528735-root"><img src="https://payloaddirectory.dev/badge/1469528735-root.svg" alt="Payload Directory"></a>README
Fork of payload-icon-picker by Vachagan Achoyan, updated for Payload CMS v4. The original GitHub repository is no longer available; the original package remains on npm (1.5.12 for Payload 3.x).
4.0.0-beta.10 prerelease (payload and @payloadcms/ui peers).jsonSchema option, replacing the removed typescriptSchema.required through to the field and its label.--theme-* admin variables with v4 semantic tokens.secondary button style and medium size, replacing the removed subtle style and xsmall size.The public imports, options and stored { name, svg } value shape are unchanged from the original.
A field plugin for Payload CMS v4 that adds a highly optimized icon picker. It supports both a searchable dropdown interface and an advanced grid-based sliding drawer panel. It automatically extracts and saves the selected icon name and its raw SVG string to the database, allowing you to render icons on your frontend without importing or bundling heavy icon packages.
select (Default): A sleek, searchable, and virtualized dropdown list.drawer: An advanced layout that opens a sliding side panel containing a performance-focused, virtualized grid of icons.@tanstack/react-virtual to seamlessly handle icon packs with over 10,000+ items without a single drop in frame rate or input latency.react-icons or custom SVG sets) globally or mapped to specific collections.fuse.js to provide lightning-fast, typo-tolerant search across all icon names in both drawer and dropdown modes.hasMany: true is configured.This fork is published as @kristianpennacchia/payload-icon-picker. Install it under the original package name, payload-icon-picker, so the imports in this README and the admin components the field registers (payload-icon-picker/client#…) resolve:
# npm
npm install payload-icon-picker@npm:@kristianpennacchia/payload-icon-picker
# pnpm
pnpm add payload-icon-picker@npm:@kristianpennacchia/payload-icon-picker
It requires Node.js ^24.22.3 || >=26.13.1 and exactly [email protected] and @payloadcms/[email protected].
payload.config.tsThe plugin can automatically add fields to collections and/or register a global icon provider.
import { buildConfig } from 'payload'
import { payloadIconPicker } from 'payload-icon-picker'
export default buildConfig({
plugins: [
payloadIconPicker({
// 1. (Optional) Auto-add fields to collections
collections: {
categories: true,
posts: {
name: 'postIcon',
label: 'Post Icon',
},
},
// 2. (Optional) Register a global provider for icons
iconPackProviderPath: './components/IconPackProvider#IconPackProvider',
}),
],
})
If you want to use a global set of icons, create a client-side provider. If you don't provide this, you'll need to pass icons directly to the field (see "Standalone Use" below).
Create a file (e.g., components/IconPackProvider.tsx):
'use client'
import React from 'react'
import { IconPackProvider as BaseProvider } from 'payload-icon-picker/client'
import { icons as LucideIcons } from 'lucide-react'
import * as FontAwesomeIcons from 'react-icons/fa'
export const IconPackProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
return (
<BaseProvider
icons={LucideIcons} // Global fallback
collections={{
posts: FontAwesomeIcons, // Collection-specific
}}
>
{children}
</BaseProvider>
)
}
[!NOTE]
💡 Integration Tip for
lucide-reactUsersIf you want to use the
lucide-reactpackage as your icon provider, avoid using wildcard imports (import * as Lucide). Wildcard imports pull in internal component factories and configuration utilities that can cause runtime scrolling errors in Next.js 16 / Turbopack environments.Instead, import the clean
iconsobject directly:import { icons as LucideIcons } from 'lucide-react' // Pass `LucideIcons` into your IconPackProviderThis guarantees a 100% stable, fast, and seamless virtualized scrolling experience in the Payload admin panel.
You can inject the icon picker manually anywhere inside your fields schema (Collections, Blocks, Globals) using the exported iconField helper. You can now define whether it should display as a standard dropdown list or a sliding drawer layout using the displayMode flag.
import { iconField } from 'payload-icon-picker'
export const MyBlock = {
slug: 'iconBlock',
fields: [
// Standard Searchable Dropdown mode (Default)
iconField({
name: 'icon',
label: 'Block Icon',
hasMany: false,
}),
// Sliding Drawer mode (multi-select)
iconField({
name: 'drawerIcon',
label: 'Drawer Icon',
hasMany: true,
displayMode: 'drawer',
}),
// Sliding Drawer mode that closes automatically on pick
iconField({
name: 'quickIcon',
label: 'Quick Icon',
hasMany: false,
displayMode: 'drawer',
closeOnSelect: true,
}),
],
}
If you want to use a specific icon pack for a single field without registering a global provider, create a simple client-side wrapper:
1. Create the wrapper (components/CustomIconPicker.tsx):
'use client'
import React from 'react'
import { IconPicker } from 'payload-icon-picker/client'
import { icons as MyIcons } from 'lucide-react'
export const CustomIconPicker = (props) => <IconPicker {...props} icons={MyIcons} />
2. Use it in your field config:
import { iconField } from 'payload-icon-picker'
const myField = iconField({
admin: {
components: {
Field: './components/CustomIconPicker#CustomIconPicker',
},
},
})
The plugin exports an IconRenderer helper component that converts a saved SVG string back into a proper React element. It parses the raw SVG, forwards your props (className, color, size, etc.) onto the root <svg> element, and requires zero icon-library dependencies on your frontend.
import { IconRenderer } from 'payload-icon-picker/client'
// Assuming `icon` was fetched from Payload (see Database Schema below)
;<IconRenderer svgString={icon.svg} size={32} color="currentColor" className="my-icon" />
| Prop | Type | Required | Description |
|---|---|---|---|
svgString | string | ✅ | The raw SVG string saved by the icon picker field. |
size | number | string | — | Sets both width and height on the <svg> element. |
color | string | — | Overrides fill and stroke colors where applicable. |
className | string | — | Appended to the SVG's existing class names. |
...rest | React.SVGProps<SVGSVGElement> | — | Any additional SVG attributes are forwarded through. |
When saved, the field outputs a structured object (or an array of objects if hasMany: true), preserving both semantic names and optimized SVG paths directly into your records. Saved values must have exactly the string properties name and svg:
// Single Select Mode (hasMany: false)
"icon": {
"name": "LuAperture",
"svg": "<svg stroke=\"currentColor\" fill=\"none\" stroke-width=\"2\" viewBox=\"0 0 24 24\" ... >...</svg>"
}
// Multi Select Mode (hasMany: true)
"icons": [
{
"name": "LuAperture",
"svg": "<svg ... >...</svg>"
},
{
"name": "LuArrowDown",
"svg": "<svg ... >...</svg>"
}
]
PayloadIconPickerConfig)| Option | Type | Default | Description |
|---|---|---|---|
collections | Record<string, boolean | Options> | undefined | Dictionary of collection slugs to append the icon field to. |
iconPackProviderPath | string | undefined | Path to the global client provider. |
name | string | 'icon' | Global fallback field name. |
hasMany | boolean | false | Global fallback for multi-select. |
closeOnSelect | boolean | false | Global fallback: auto-close the drawer after selecting an icon (drawer mode, single-select only). Also settable per collection inside collections. |
label | string | 'Icon' | Global fallback label. |
required | boolean | false | Global fallback: require an icon. Also settable per collection inside collections. |
displayMode | 'drawer' | 'select' | 'select' | Global fallback display mode. |
disabled | boolean | false | If true, disables the plugin. |
drawerItemsPerRow | number | 20 | Global fallback for number of icons per row in drawer mode. |
drawerIconSize | number | 24 | Global fallback for icon display size inside the drawer. |
drawerRowHeight | number | 80 | Global fallback for virtualized row container height. |
iconField)| Option | Type | Default | Description |
|---|---|---|---|
name | string | 'icon' | Field name. |
label | string | 'Icon' | Field label. |
hasMany | boolean | false | Enable multi-select. |
required | boolean | false | Require an icon (at least one with hasMany). |
closeOnSelect | boolean | false | Auto-close the drawer after selecting an icon (drawer mode, ignored when hasMany: true). |
description | string | undefined | Helper text. |
displayMode | 'drawer' | 'select' | 'select' | Display mode. |
drawerItemsPerRow | number | 20 | Number of icons per row in drawer mode. |
drawerIconSize | number | 24 | Icon rendering size inside the drawer. |
drawerRowHeight | number | 80 | Virtualized row container height. |
admin | FieldAdmin | undefined | Standard Payload admin field config. |
npm install
npm run build
npm test
MIT. Original work © 2026 Vachagan Achoyan; Payload v4 changes © 2026 Kristian Pennacchia. See LICENSE.
Tags
icons
Manage SVG icons as CMS content with icon sets, an admin select widget and a server Icon component
5732/wk37v3
payload plugin icons
Icon picker field for Payload with Lucide and Phosphor providers and a React rendering component
5522/wk2v3
payload icon picker
Icon picker field for the Payload admin with adapters for Lucide, Tabler, Heroicons, Phosphor and more
53243/wk1v3
payload icon picker field
Icon picker field for Payload supporting react-icons packs or custom SVG icons
2657v3
payload fields
Field factories and admin components for Unicode slugs, Jalali dates, integer money and Iranian identity data
75230/wk3v3
payload plugin json form builder
Edit a Payload json field as real admin fields, with the form shape built in the admin panel
72441/wk37v3