Folder Code
An animated folder-code icon built on motion/react that shows a folder outline with two code brackets which slide and tilt outward on hover or when controlled via ref. It renders an inline SVG at a configurable size and inherits color from currentColor.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
import { FolderCodeIcon } from "@/components/ui/folder-code";export default function Example() { return <FolderCodeIcon size={28} className="text-foreground" />;}- Use as a hover-animated icon for developer tools, repository, project, or code-workspace navigation items.
- Use in menus, sidebars, or cards where a folder labelled as containing code should subtly react to hover.
- Use when you need an imperative trigger so a parent component can start or stop the animation via a ref, for example on focus or on a loading state.
- Avoid in dense icon grids where continuous motion would be distracting, or where the icon is purely decorative and should stay static.
Examples
Hover-animated sidebar item
Hovering the wrapper div triggers the built-in animation, since the icon listens to mouse enter and leave events by default.
import { FolderCodeIcon } from "@/components/ui/folder-code";export default function SidebarProjects() { return ( <button className="flex items-center gap-2 rounded-md px-3 py-2 hover:bg-accent"> <FolderCodeIcon size={20} className="text-muted-foreground" /> <span>Projects</span> </button> );}Imperative control via ref
A parent holds a ref to the handle and starts or stops the animation programmatically, for example while a repository is syncing.
import { useRef, useEffect } from "react";import { FolderCodeIcon, type FolderCodeIconHandle } from "@/components/ui/folder-code";export default function SyncingFolder({ isSyncing }: { isSyncing: boolean }) { const iconRef = useRef<FolderCodeIconHandle>(null); useEffect(() => { if (isSyncing) { iconRef.current?.startAnimation(); } else { iconRef.current?.stopAnimation(); } }, [isSyncing]); return <FolderCodeIcon ref={iconRef} size={32} />;}Custom hover handlers in controlled mode
When a ref is attached, the component stops running its own animation on hover and instead forwards mouse events to the provided handlers.
import { useRef } from "react";import { FolderCodeIcon, type FolderCodeIconHandle } from "@/components/ui/folder-code";export default function ControlledFolder() { const iconRef = useRef<FolderCodeIconHandle>(null); return ( <div onMouseEnter={() => iconRef.current?.startAnimation()} onMouseLeave={() => iconRef.current?.stopAnimation()} > <FolderCodeIcon ref={iconRef} size={24} onMouseEnter={(e) => console.log("enter", e.type)} /> </div> );}API reference
Accessibility
- The icon renders an SVG with no title or aria-label; when the icon conveys meaning, pass aria-label or role="img" via props on the wrapper, or place visible text next to it.
- If the icon is purely decorative, add aria-hidden="true" through the spread props so screen readers skip it.
- The animation is hover-driven and not keyboard-triggered; when the icon is part of an interactive control, also start the animation on focus through the ref handle so keyboard users receive the same feedback.
- The motion is a short 0.5s transition; consider respecting prefers-reduced-motion by not calling startAnimation when the user prefers reduced motion.
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 "Folder Code" component (lucide-animated/folder-code) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/folder-code.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, onMouseEnter, onMouseLeave, ref, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { FolderCodeIcon } from "@/components/ui/folder-code";export default function Example() { return <FolderCodeIcon size={28} className="text-foreground" />;}```Files & dependencies
- folder-code.tsx