A Lucide icon library package for React applications providing comprehensive SVG icons as tree-shakable React components.
npx @tessl/cli install tessl/npm-lucide-react@0.542.0Lucide React is a comprehensive icon library package for React applications that provides SVG icons as tree-shakable React components. It offers a complete implementation of the Lucide icon collection with customizable styling, sizing, and color properties, designed for maximum performance and flexibility with zero dependencies beyond React.
npm install lucide-reactimport { Camera, Grid, Pen } from "lucide-react";
import { Icon } from "lucide-react";
import { createLucideIcon } from "lucide-react";
import { icons } from "lucide-react";For CommonJS:
const { Camera, Grid, Pen, Icon } = require("lucide-react");Dynamic imports:
import { DynamicIcon, iconNames } from "lucide-react/dynamic";import { Camera, Grid, Pen } from "lucide-react";
// Basic icon usage
const App = () => {
return (
<div>
<Camera />
<Grid size={32} color="blue" />
<Pen strokeWidth={3} className="my-icon" />
</div>
);
};Lucide React is built around several key components:
Camera, Grid) created from SVG dataIcon component that renders SVG from icon node dataDynamicIcon component for runtime icon selection by namecreateLucideIcon function for creating new icon componentsLucideProps and IconNode typesIndividual React components for each Lucide icon, optimized for tree-shaking and static imports. Perfect for when you know which icons you need at build time.
type LucideIcon = ForwardRefExoticComponent<
Omit<LucideProps, 'ref'> & RefAttributes<SVGSVGElement>
>;
interface LucideProps extends ElementAttributes {
size?: string | number;
absoluteStrokeWidth?: boolean;
}Runtime icon loading system for displaying icons based on string names. Useful for CMS-driven applications or when icon selection is determined at runtime.
function DynamicIcon(props: DynamicIconProps): JSX.Element;
interface DynamicIconProps extends LucideProps {
name: IconName;
fallback?: () => JSX.Element | null;
}
type IconName = keyof typeof dynamicIconImports;
const iconNames: Array<IconName>;
const dynamicIconImports: Record<string, () => Promise<DynamicIconModule>>;
interface DynamicIconModule {
default: LucideIcon;
__iconNode: IconNode;
}System for creating custom icon components from icon data, supporting Lucide Lab icons and custom SVG definitions.
function Icon(props: IconComponentProps): JSX.Element;
function createLucideIcon(iconName: string, iconNode: IconNode): LucideIcon;
interface IconComponentProps extends LucideProps {
iconNode: IconNode;
}
type IconNode = [elementName: SVGElementType, attrs: Record<string, string>][];import type { SVGProps, ForwardRefExoticComponent, RefAttributes } from 'react';
type SVGElementType =
| 'circle'
| 'ellipse'
| 'g'
| 'line'
| 'path'
| 'polygon'
| 'polyline'
| 'rect';
type IconNode = [elementName: SVGElementType, attrs: Record<string, string>][];
type SVGAttributes = Partial<SVGProps<SVGSVGElement>>;
type ElementAttributes = RefAttributes<SVGSVGElement> & SVGAttributes;
interface LucideProps extends ElementAttributes {
size?: string | number;
absoluteStrokeWidth?: boolean;
}
type LucideIcon = ForwardRefExoticComponent<
Omit<LucideProps, 'ref'> & RefAttributes<SVGSVGElement>
>;