docs/guide/react/advanced/dynamic-icon-component.md
It is possible to use one generic icon component to load icons. But it is not recommended, since it is importing all icons during the build. See Caveats.
DynamicIcon is useful for applications that want to show icons dynamically by icon name. For example, when using a content management system where icon names are stored in a database.
For static use cases, it is recommended to import the icons directly.
The same props can be passed to adjust the icon appearance. The name prop is required to load the correct icon.
import { DynamicIcon } from 'lucide-react/dynamic';
const App = () => (
<DynamicIcon name="camera" color="red" size={48} />
);
::: info Caveats