Lucide
What is Lucide?
Lucide is an evolution of Feather Icons featuring MIT-licensed SVG icons maintained by the community. Technical highlights:
- Vector Scalability: Pure SVG implementation ensures sharp rendering at any resolution
- Framework Agnostic: Core package (@lucide/icons) + framework-specific wrappers (React, Vue, Svelte)
- TypeScript Support: First-class type definitions included
- Semantic Versioning: Stable API following semver conventions
# Installation
npm install lucide
# React specific
npm install @lucide/react
Implementation Guide
Web (Vanilla JS)
<script src="https://unpkg.com/lucide@latest"></script>
<script>
// Initialize with options
lucide.createIcons({
strokeWidth: 1.5,
class: "icon-class",
});
</script>
React Component
import { Camera } from "lucide-react";
// Customizable via props
<Camera size={24} color="#ff0000" strokeWidth={1.5} className="custom-class" />;
Advanced Features
- Tree Shaking Optimization: Import individual icons to minimize bundle sizes:
import { AlertCircle } from "lucide";
// Bundle size: only 1.2kb (gzipped)
- Dynamic Loading:
const LazyIcon = React.lazy(() =>
import("lucide-react").then((module) => ({
default: module.Smile,
}))
);
- CSS Customization:
.icon-class {
stroke-dasharray: 5;
filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}
Design Integration
- Figma File: Official design resources available at lucide.dev/figma
- Style Inheritance:
<div style="stroke: #555; stroke-width: 1.2">
<i data-lucide="mail"></i>
</div>
Performance Comparison
Feature | Lucide | Feather | Material Icons |
---|---|---|---|
Average Size | 2.1KB | 5.8KB | 42KB |
Tree Shaking | Yes | Partial | No |
SVG Sprite | Yes | No | No |
Migration from Feather
npm uninstall feather-icons
npm install lucide
Update imports:
// Before
import { icon } from "feather-icons";
// After
import { Icon } from "lucide";
Contribution Workflow
- Clone the repository
- Create SVG files in
icons/
directory - Run icon build process:
pnpm build
- Submit pull request with new SVG files