A custom field extension for DatoCMS that provides a searchable icon selector using Lucide Icons.
npm installAssign the Lucide Icon Selector editor to any string field via the DatoCMS schema editor:
When you manually assign the Lucide Icon Selector to a string field, you can configure exactly which icons are available for selection:
When icons are whitelisted, content editors can only pick from the configured set. If no icons are whitelisted, all Lucide icons are available.
To reset the whitelist back to "all icons", clear the configuration settings for that field.
The plugin stores the icon name as a string. Use it with the Lucide React library:
import { Heart, Star, User } from "lucide-react";
// Get the icon name from DatoCMSconst iconName = record.icon; // e.g., "Heart"
// Use it in your componentconst IconComponent = { Heart, Star, User }[iconName];return <IconComponent size={24} />;Or dynamically:
import * as LucideIcons from "lucide-react";
const iconName = record.icon;const IconComponent = LucideIcons[iconName as keyof typeof LucideIcons];return IconComponent ? <IconComponent size={24} /> : null;The plugin works by:
Canvas component and native CSS custom properties# Install dependenciesnpm install
# Start development servernpm run dev
# Build for productionnpm run build
# Preview production buildnpm run previewsrc/ ├── entrypoints/ │ ├── ConfigScreen.tsx # Plugin configuration screen │ ├── FieldExtensionConfigScreen.tsx # Per-field icon filtering config screen │ ├── IconSelectField.tsx # Main icon selector field component │ └── styles.module.css # Component styles ├── utils/ │ ├── lucideIcons.ts # Lucide icon names utility │ └── render.tsx # React rendering utility └── main.tsx # Plugin entry pointMIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For issues, questions, or feature requests, please open an issue on the GitHub repository.