Lucide React Dynamic Icons And Lucide Lab
Pack:
lucide-reactSource:lucide-react/lucide-react-dynamic-icons-and-lucide-lab/SKILL.mdUse this skill when the app cannot rely only on static named imports fromlucide-react.
DynamicIconand dynamic icon names- caveats of data-driven icon loading
@lucide/lab- the
Iconcomponent - custom
iconNodedata - choosing between direct imports, dynamic loading, and Lab/custom icons
Default path
Section titled “Default path”- Read references/dynamic-and-lab.md.
- Ask whether the icon list is static or data-driven.
- If the icon set is static, route back to
lucide-react-overview-and-setupand use direct imports. - Use
DynamicIcononly when icon names truly come from runtime data such as CMS entries or database rows. - Use
Iconwith@lucide/labor custom icon nodes when the app needs icons outside the core Lucide package.
When to deviate
Section titled “When to deviate”- Keep the core package only when all icons are in the main Lucide set.
- Use
Iconplus@lucide/labfor non-core or custom nodes rather than forcing everything throughDynamicIcon. - Validate or normalize icon names before render when they come from remote data.
- Move back to the overview skill when the icon set turns out to be static after all.
Guardrails
Section titled “Guardrails”DynamicIconis not the default path; it increases build and delivery cost.- Expect SSR and loading-state considerations when icon names are resolved dynamically.
- Keep runtime icon names validated or normalized instead of trusting arbitrary strings.
- Use
Iconfor Lucide Lab or custom icon nodes, notDynamicIcon. - Treat
@lucide/labas an extension set, not the baseline icon dependency for every project.
- using
DynamicIconfor a static set of known icons - trusting arbitrary runtime icon names without validation
- treating
@lucide/labas a required dependency for normal app usage - using
DynamicIconwhen the real need is a Lab or custom icon node
Verification checklist
Section titled “Verification checklist”- the icon set is confirmed to be static or runtime-driven
DynamicIconis only used for real runtime-name scenarios- Lab or custom nodes use
Icon, notDynamicIcon - remote icon names are validated or normalized
- SSR and loading behavior are considered when icons load dynamically
Quick examples
Section titled “Quick examples”Lucide Lab:
import { Icon } from "lucide-react";import { coconut } from "@lucide/lab";
export function LabExample() { return <Icon iconNode={coconut} />;}Dynamic icon by name:
import { DynamicIcon } from "lucide-react/dynamic";
export function CmsIcon({ name }: { name: string }) { return <DynamicIcon name={name} size={18} />;}Current snapshot
Section titled “Current snapshot”- Checked against official docs on 2026-04-03
- Current npm line verified live on 2026-04-03:
@lucide/lab@0.1.2 - Official React docs still recommend direct imports for static use cases and reserve
DynamicIconfor runtime-name scenarios