AgentSkillsCN

lucide-react

为本 Electron 应用中的 React 组件提供 Lucide 图标库。 适用于:为 UI 组件添加图标、用 Lucide 图标替换 FontAwesome 图标、自定义图标大小/颜色/描边样式,或与期望使用 Lucide 图标的 shadcn/ui 组件协同工作时使用。

SKILL.md
--- frontmatter
name: lucide-react
description: |
  Provides the Lucide icon library for React components in this Electron app.
  Use when: adding icons to UI components, replacing FontAwesome icons with Lucide equivalents,
  customizing icon size/color/stroke, or working with shadcn/ui components that expect Lucide icons.
allowed-tools: Read, Edit, Write, Glob, Grep, Bash, mcp__context7__resolve-library-id, mcp__context7__query-docs

Lucide React

Lucide is the icon library specified for this project (configured in components.json). The codebase currently uses FontAwesome but is migrating to lucide-react per the implementation plan. All new components MUST use lucide-react. shadcn/ui CLI generates Lucide imports by default.

Quick Start

Install

bash
pnpm add lucide-react

Basic Usage

tsx
import { FileText, ChevronDown, Plus } from "lucide-react";

function Toolbar() {
  return (
    <button className="text-muted-foreground flex items-center gap-1.5">
      <Plus className="size-4" />
      <span>Add Item</span>
    </button>
  );
}

With Tailwind Sizing (Project Convention)

tsx
// GOOD — Use Tailwind size classes
<Camera className="size-4" />
<Camera className="size-3" />
<Camera className="h-4 w-4" />

// BAD — Don't use size/color props when Tailwind works
<Camera size={16} color="#58a6ff" />

Key Concepts

ConceptUsageExample
Named importsTree-shakable, one per iconimport { Search } from "lucide-react"
Tailwind sizingUse size-* or h-* w-* classesclassName="size-4"
Color inheritanceIcons inherit currentColorParent text-accent colors the icon
strokeWidthProp for line thickness (default 2)strokeWidth={1.5}
Dynamic iconsUse DynamicIcon for name-based loadingAvoid in static UI — hurts tree-shaking

FontAwesome to Lucide Migration Map

FontAwesomeLucideContext
faXmarkXDialog close
faSearchSearchCommand palette
faCheckCheckSelect checkmarks
faSpinnerLoader2Loading (use animate-spin)
faChevronUpChevronUpSelect, number input
faChevronDownChevronDownSelect, tree expand
faCalendarCalendarDate picker
faHomeHomeNavigation
faSun / faMoonSun / MoonTheme toggle
faRocketRocketQuick start
faTerminalTerminalScripts
faCodeCodeFeatures
faPalettePaletteCustomization
faPlugPlugIntegrations
faCogSettingsSettings
faCircleCheckCircleCheckToast success
faCircleXmarkCircleXToast error
faTriangleExclamationTriangleAlertToast warning
faCircleInfoInfoToast info

EFIS Editor Icons (New Components)

Icons needed for the editor panels per UI/UX spec:

PurposeLucide IconComponent
Drag handleGripVerticalchecklist-item-row.tsx
Expand/CollapseChevronRight / ChevronDownTree groups, collapsible items
File iconFileTextFiles sidebar
ImportUploadToolbar
ExportDownloadToolbar
Undo / RedoUndo2 / Redo2Toolbar
Add itemPlusToolbar, editor
DeleteTrash2Context menus
EditPencilInline edit trigger
PropertiesSlidersHorizontalToolbar toggle
KeyboardKeyboardStatus bar shortcuts
WarningTriangleAlertWarning items
New fileFilePlusSidebar header

See Also

Related Skills

  • See the shadcn-ui skill — shadcn components expect Lucide icons by default
  • See the tailwind skill — icon sizing/coloring via Tailwind classes
  • See the react skill — component patterns for icon wrappers

Documentation Resources

Fetch latest lucide-react documentation with Context7.

How to use Context7:

  1. Use mcp__context7__resolve-library-id to search for "lucide-react"
  2. Prefer website documentation (IDs starting with /websites/)
  3. Query with mcp__context7__query-docs using the resolved library ID

Library ID: /websites/lucide_dev_guide_packages

Recommended Queries:

  • "lucide-react icon props customization"
  • "lucide-react dynamic icon loading"
  • "lucide-react tree-shaking best practices"