folder-plus

An animated folder-plus icon for React built on motion/react. On hover, or when controlled via a ref, a plus sign draws itself inside a folder outline.

folder-plus
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @heroicons-animated/folder-plus

Requires @heroicons-animated in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { FolderPlusIcon } from "@/components/ui/folder-plus";export default function Example() {  return <FolderPlusIcon size={28} />;}
  • Add a plus-folder affordance such as 'New folder' or 'Create project' buttons and menu items
  • Give hover feedback on folder-creation actions in file managers, sidebars, or dashboards
  • Trigger the draw-in animation programmatically (for example after a successful create) through the ref handle
  • Need a lightweight, theme-aware icon that follows text color and scales via the size prop

Examples

Hover-driven button

A button that animates the icon on pointer hover using the default uncontrolled behavior.

hover-driven-button.tsx
import { FolderPlusIcon } from "@/components/ui/folder-plus";export default function NewFolderButton() {  return (    <button      type="button"      className="inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm"    >      <FolderPlusIcon size={20} />      New folder    </button>  );}

Programmatic control via ref

Start and stop the animation imperatively, for example while a create request is pending.

programmatic-control-via-ref.tsx
import { useRef } from "react";import { FolderPlusIcon, type FolderPlusIconHandle } from "@/components/ui/folder-plus";export default function CreateFolder() {  const iconRef = useRef<FolderPlusIconHandle>(null);  return (    <div      onMouseEnter={() => iconRef.current?.startAnimation()}      onMouseLeave={() => iconRef.current?.stopAnimation()}    >      <FolderPlusIcon ref={iconRef} size={32} className="text-blue-600" />    </div>  );}

Icon-only menu item

Use the icon inside a navigation list with a custom color and size.

icon-only-menu-item.tsx
import { FolderPlusIcon } from "@/components/ui/folder-plus";export default function SidebarItem() {  return (    <a href="/projects/new" className="flex items-center gap-3 text-neutral-700 hover:text-neutral-900">      <FolderPlusIcon size={18} />      <span>Create project</span>    </a>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels.
classNamestring—Class name applied to the wrapping div. Use it to set color (via currentColor) and layout.
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Mouse enter handler. Called after the hover animation only when the ref handle is attached; otherwise the component plays the animation itself and this is invoked by the same handler path.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Mouse leave handler. Same controlled-mode behavior as onMouseEnter; in uncontrolled mode the icon returns to its resting state.
refReact.Ref<FolderPlusIconHandle>—Forwarded ref exposing startAnimation() and stopAnimation(). Attaching it switches the component into controlled mode, so hover no longer auto-animates.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes are spread onto the wrapping div (for example id, aria-*, style, onClick).

Accessibility

  • The icon is decorative SVG with no title or role; when it conveys meaning, place adjacent visible text or set aria-label and role="img" on the wrapper div.
  • If the icon is the only content of a button or link, give that control an accessible name via aria-label, since the SVG exposes no text.
  • The animation is a short decorative draw-in; it does not convey essential information. Respect prefers-reduced-motion by avoiding programmatic startAnimation() calls when the user requests reduced motion.
  • Stroke uses currentColor, so ensure the surrounding text color meets WCAG contrast requirements against the background.

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.

prompt.md
Use the "folder-plus" component (heroicons-animated/folder-plus) from its shadcn registry.1. Install it with: npx shadcn@latest add @heroicons-animated/folder-plus2. 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 { FolderPlusIcon } from "@/components/ui/folder-plus";export default function Example() {  return <FolderPlusIcon size={28} />;}```

Files & dependencies

  • folder-plus.tsx
dependenciesmotion

Looks similar, elsewhere