@i316/lucide-react
v0.1.1
Published
i316: Lucide icons as tree-shakeable React components.
Maintainers
Readme
@i316/lucide-react
i316: Lucide icons as React components. 2,194 icons in 2 styles: linear (default), outlined.
Other i316 Lucide packages: @i316/lucide-react-native (React Native), @i316/lucide-vue (Vue 3), @i316/lucide-angular (Angular) and @i316/lucide-web (plain HTML web component and raw SVGs).
npm install @i316/lucide-reactUsage
// One style: every icon is exported as both `Bell` and `BellIcon`.
import { ChevronDown, BellIcon } from '@i316/lucide-react/linear';
// Any style from the root: <Name><Style>Icon, or <Name>Icon to switch style at runtime.
import { BellOutlinedIcon, HouseIcon } from '@i316/lucide-react';
<ChevronDown size={20} color="#e11d48" />
<BellOutlinedIcon className="text-slate-500" title="Notifications" />
<HouseIcon variant={isActive ? 'outlined' : 'linear'} />Works in React Server Components: icons can be rendered directly from server components (Next.js App Router).
Defaults for a whole subtree
import { LucideIconProvider } from '@i316/lucide-react';
<LucideIconProvider size={20} color="currentColor" strokeWidth={2} className="shrink-0">
<App />
</LucideIconProvider>Props on an icon override the provider. Nested providers override their parent's values.
Icons chosen at runtime (CMS, user settings)
import { DynamicIcon, iconNames } from '@i316/lucide-react/dynamic';
<DynamicIcon name={item.icon} variant="outlined" fallback={<Spinner />} />Each icon is loaded as its own chunk the first time it renders. This is opt-in: only apps that import /dynamic pay for its map of every icon name.
Tree-shaking
Every icon is its own module and the package is sideEffects-free. Production builds in Vite, webpack, Rollup, esbuild and Next.js ship only the icons you import, whichever path you import from. <Name>Icon from the root includes every style of that one icon; import a specific style when you don't need switching.
Toolchains that don't tree-shake load a whole barrel for one named import: webpack in development, Jest, and anything else that runs modules unbundled. Two fixes:
Babel (Jest, webpack/babel-loader): add the bundled plugin. It rewrites import { Bell } from '…/linear' into import Bell from '…/linear/bell' at compile time.
// babel.config.js
module.exports = {
plugins: ['@i316/lucide-react/babel'],
};Next.js (SWC, no Babel): use Next's own barrel optimization.
// next.config.js
module.exports = {
experimental: { optimizePackageImports: ['@i316/lucide-react'] },
};Props
| Prop | Default | |
|---|---|---|
| size | 24 | width and height |
| color | currentColor | icon color |
| strokeWidth | 1.5 | linear only; ignored by the other styles |
| title | none | accessible name (see below) |
| variant | linear | <Name>Icon and DynamicIcon only: which style to render |
All other props pass through to the root <svg> (className, style, onClick, …), and ref is forwarded.
Accessibility: icons are decorative by default (aria-hidden="true"). Pass title to make one meaningful: it renders a <title> with role="img". Passing your own aria-label or role also removes aria-hidden.
Styling: every icon has the classes lucide-icon lucide-icon-<name> (e.g. lucide-icon-chevron-down), plus any className you pass.
Editor previews: hovering an icon imported from a style path (@i316/lucide-react/linear) in VS Code (or any TypeScript editor) shows a picture of it. Root imports have no previews, which keeps them light for the editor.
Module format, TypeScript and Jest
ESM only, with TypeScript declarations included. moduleResolution "bundler", "node16" and legacy "node" all resolve every import path. Node 20.19+ and 22.12+ can require() it. Peer dependency: react >= 16.8.
Jest's default CommonJS mode needs it transformed by your Babel setup (babel-jest), the usual configuration for ESM-only packages. Adding the plugin above keeps each test file from loading every icon:
// jest.config.js
transformIgnorePatterns: ['/node_modules/(?!@i316/lucide-react/)'],License
Icons: Lucide Icons and Contributors (icons derived from Feather by Cole Bemis are MIT) (https://github.com/lucide-icons/lucide), licensed under ISC (and MIT for icons derived from Feather). i316 modified them: default stroke width changed from 2 to 1.5; the "outlined" style is generated from the original strokes by stroke-to-fill tracing; reformatted and grouped into folders by each icon's primary upstream category; converted into React, React Native, Vue, Angular and web-component formats.
i316 code (components, runtime, tooling): MIT, © 2026 rahil316. See LICENSE for both licenses in full.
