Folders
An animated folders icon built on an SVG with Motion, where the folder tab and back panel shift and fade on hover or when the imperative startAnimation handle is called. It is a drop-in lucide-style icon component exposing a ref handle for programmatic control.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
import { FoldersIcon } from "@/components/ui/folders";export default function Example() { return <FoldersIcon />;}- Use as an animated folder icon in file explorers, project lists, or sidebar navigation where a hover micro-interaction is desired.
- Use inside buttons or links to signal that clicking opens a directory or a folder-related section.
- Use when you need to trigger the folder-opening animation programmatically (for example, when a folder row is selected) via the ref handle.
- Avoid in dense tables or places where constant motion would be distracting, or where a static icon is preferred.
Examples
Hover-animated folder in a sidebar link
Default hover behavior: the icon animates on mouse enter and resets on mouse leave, with a custom size and className for color.
import { FoldersIcon } from "@/components/ui/folders";export default function SidebarItem() { return ( <a href="/projects" className="flex items-center gap-2 text-sm"> <FoldersIcon size={20} className="text-blue-500" /> <span>Projects</span> </a> );}Programmatic control via ref
Use the ref handle to start and stop the animation from parent code, for example when a row becomes active. Because the ref is attached, the component's own mouse handlers defer to the parent's onMouseEnter/onMouseLeave props.
import { useRef } from "react";import { FoldersIcon, type FoldersIconHandle } from "@/components/ui/folders";export default function FolderRow({ active }: { active: boolean }) { const iconRef = useRef<FoldersIconHandle>(null); return ( <div onMouseEnter={() => iconRef.current?.startAnimation()} onMouseLeave={() => iconRef.current?.stopAnimation()} > <FoldersIcon ref={iconRef} size={24} /> </div> );}Folder button with accessible label
Wrap the icon in a button with an aria-label, since the icon itself carries no text alternative.
import { FoldersIcon } from "@/components/ui/folders";export default function OpenFoldersButton({ onOpen }: { onOpen: () => void }) { return ( <button type="button" aria-label="Open folders" onClick={onOpen} className="p-2"> <FoldersIcon size={20} /> </button> );}API reference
Accessibility
- The icon is decorative SVG with no title or role; when it conveys meaning, provide an accessible name on a surrounding button or link (aria-label or visible text).
- If the icon is purely decorative next to visible text, add aria-hidden="true" on the FoldersIcon element to hide it from assistive technology.
- The animation is a short decorative motion; respect users with reduced-motion preferences by avoiding triggering startAnimation automatically on page load or in loops.
- Because the wrapper is a div, do not rely on it for focus or keyboard activation; place it inside a focusable button or link for interactive use.
Docs written by anthropic:claude-haiku-5-5 from the registry source.
Use with Coding Agent
Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.
Use the "Folders" component (lucide-animated/folders) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/folders.json2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: size, className, ...props, ref.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { FoldersIcon } from "@/components/ui/folders";export default function Example() { return <FoldersIcon />;}```Files & dependencies
- folders.tsx