Overview
Lucide Animated icons are built as React components that combine Lucide SVG icons with Framer Motion animations. Each icon component follows a consistent architecture pattern that enables both automatic hover animations and programmatic control.Core Architecture
Every icon component in Lucide Animated follows this structure:Key Components
Dual-Mode System
Each icon supports two operating modes:Uncontrolled Mode
Default behavior - animations trigger automatically on hover
Controlled Mode
Programmatic control via ref - animations triggered by
startAnimation() and stopAnimation() methodsAnimation Control Flow
TheisControlledRef pattern determines which mode the icon operates in:
isControlledRef.current becomes true, disabling automatic hover animations.
Mouse Event Handlers
The handlers check the control mode before triggering animations:Animation with Framer Motion
All animations use Framer Motion’smotion components and useAnimation hook:
Simple Animation Example
Fromheart.tsx:61-82:
Complex Multi-Element Animation
Fromsmile.tsx:109-157:
Multiple Animation Controls
Some icons use multipleuseAnimation() instances for complex choreography.
From sparkles.tsx:54-70:
Variants Pattern
Variants define animation states. They can be defined inline or as constants:Design Principles
Consistency
All icons follow the same structural pattern for predictable behavior
Flexibility
Support both automatic and manual animation control
Composition
Built with standard React patterns (forwardRef, useImperativeHandle)
Performance
Use
useCallback for memoized event handlersTemplate Structure
When creating new icons, follow this template from CONTRIBUTING.md:- Client Component Directive: Start with
'use client'; - Type Definitions: Export
[IconName]Handleinterface and props interface - Component Implementation: Use
forwardRefwith proper typing - Animation Setup: Initialize
useAnimation()andisControlledRef - Ref Handling: Implement
useImperativeHandlefor control API - Event Handlers: Create memoized mouse event callbacks
- Render: Return wrapper div with motion.svg and animation variants
- Display Name: Set component displayName for debugging