Icon Button
Animated icon button with particle burst and glow effects on activation.
When to Use
Use Icon Button when you need:
- Toggleable icon actions with visual feedback (like, star, bookmark)
- Animated micro-interactions that delight users
- Social engagement actions (heart, thumbs up, share)
- Notification or alert toggles with clear state indication
- Any icon action where the "active" state should feel rewarding
Interactive Demo
Click each icon to trigger particle burst and glow effects. Includes popular icons with custom colors and size variants.
Popular Icons
Click each icon to trigger particle burst and glow effects
Size Variants
Brand Colors
Without Animation
Disabled
Size Variants
Four size options: sm (24px), default (32px), md (40px), lg (48px). Each size has optimized particle count.
Custom Colors
Use RGB color arrays to customize icon, particle, and glow colors. Perfect for brand colors or semantic meanings.
Animation Control
Disable animations with the animate prop, or customize spring physics with the transition prop.
States
The active prop controls the filled state and glow effect. Disabled state prevents interaction.
Common Use Cases
Perfect for social interactions, favorites, notifications, and any toggleable actions.
UX & Design Guidelines
Visual Hierarchy
Icon buttons are designed for secondary, toggleable actions. Use them alongside content (cards, list items) rather than as primary page actions. The particle animation rewards user interaction and provides clear feedback on state change.
Color Semantics
- Red
[239, 68, 68]— Hearts, likes, favorites - Yellow
[234, 179, 8]— Stars, ratings, highlights - Blue
[59, 130, 246]— Shares, links, info actions - Purple
[147, 51, 234]— Bookmarks, saves, collections - Coral
[227, 103, 77]— Notifications, alerts (default)
Animation Considerations
Animations trigger only on activation (inactive → active), not deactivation. This creates a rewarding "pop" effect when users engage. For users who prefer reduced motion, set animate={false} or respect the prefers-reduced-motion media query.
Responsive Behavior
Use size="md" or size="lg" on touch devices for comfortable 44×44px minimum touch targets. The default 32px size works well for desktop hover-based interactions.
Accessibility
Keyboard Navigation
- Tab — Move focus to/from the button
- Enter or Space — Toggle the button state
- Focus ring uses the system ring color for consistency
Screen Reader Support
- Always provide
aria-label— icon buttons have no visible text - Use dynamic labels that reflect current state (e.g., "Unlike" vs "Like")
- Add
aria-pressed={active}for toggle semantics - Disabled state is announced automatically via the
disabledattribute
Focus Management
Visible focus ring with 2px width using focus-visible:ring-2. The ring uses ring-ring color with offset for visibility against any background.
Motion Preferences
For users with vestibular disorders, disable animations via animate={false}. Consider checking window.matchMedia('(prefers-reduced-motion: reduce)') and passing the result to the animate prop.
ARIA Attributes
{/* Toggle button with dynamic label */}
<IconButton
icon={Heart}
active={isLiked}
onClick={() => setIsLiked(!isLiked)}
aria-label={isLiked ? "Unlike this item" : "Like this item"}
aria-pressed={isLiked}
/>
{/* With description for screen readers */}
<div>
<IconButton
icon={Bell}
active={notificationsOn}
aria-describedby="notification-hint"
aria-label="Toggle notifications"
aria-pressed={notificationsOn}
/>
<span id="notification-hint" className="sr-only">
{notificationsOn
? "Notifications are currently enabled"
: "Notifications are currently disabled"}
</span>
</div>Related Components
API Reference
The IconButton component accepts the following props in addition to standard button attributes.
| Prop | Type | Default | Description |
|---|---|---|---|
| icon | React.ElementType | — | Any Lucide React icon component to display. |
| active | boolean | false | Current activation state. When true, icon is filled and glows. |
| animate | boolean | true | Enable particle burst and glow animations on activation. |
| size | "sm" | "default" | "md" | "lg" | "default" | Button and icon size preset. Each size has optimized particle count. |
| color | [number, number, number] | [227, 103, 77] | RGB color values for icon, particles, and glow effect. |
| transition | Transition | { type: "spring", stiffness: 300, damping: 15 } | Framer Motion spring animation configuration. |
| onClick | () => void | — | Click handler for state changes and interactions. |
| disabled | boolean | false | When true, prevents interaction and dims the button. |
| className | string | — | Additional CSS classes to apply to the button. |