folder-open

An animated outline folder icon from the hugeicons-animated registry that opens its flap and lifts its arrow on hover, playing once per hover. It is built with motion and exposes an imperative ref to start the animation manually.

folder-open
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 @hugeicons-animated/folder-open

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

Usage

usage.tsx
import { FolderOpenIcon } from '@/components/icons/folder-open';export function Example() {  return <FolderOpenIcon />;}
  • Use as a folder or file-browser icon in navigation, sidebars, or file trees where a subtle hover motion adds life without distracting.
  • Use for 'open folder' states, such as expanding a directory or showing a folder being revealed after a click.
  • Use inside buttons or links that open a folder or project, where hover feedback reinforces the action.
  • Avoid when a static icon is required or when the animation would conflict with a parent component that already animates on hover.

Examples

Basic hover icon

Renders the icon with default size (28px). The animation plays on mouse enter.

basic-hover-icon.tsx
import { FolderOpenIcon } from '@/components/icons/folder-open';export default function BasicExample() {  return <FolderOpenIcon />;}

Imperative control via ref

Passing a ref switches the component into controlled mode, so hovering no longer auto-plays and the parent calls startAnimation() instead.

imperative-control-via-ref.tsx
import { useRef } from 'react';import { Button } from '@/components/ui/button';import { FolderOpenIcon } from '@/components/icons/folder-open';import type { FolderOpenIconHandle } from '@/components/icons/folder-open';export default function ControlledExample() {  const iconRef = useRef<FolderOpenIconHandle>(null);  return (    <Button      variant='outline'      onClick={() => iconRef.current?.startAnimation()}    >      <FolderOpenIcon ref={iconRef} size={20} />      Open folder    </Button>  );}

Custom size and color in a file tree row

Uses size and a Tailwind text color class (currentColor drives the stroke) with a hover handler supplied through the standard div props.

custom-size-and-color-in-a-file-tree-row.tsx
import { FolderOpenIcon } from '@/components/icons/folder-open';export default function TreeRowExample() {  return (    <div className='flex items-center gap-2 text-sky-600'>      <FolderOpenIcon        size={18}        className='shrink-0'        onMouseEnter={() => console.log('folder hover')}      />      <span className='text-sm text-zinc-900'>Projects</span>    </div>  );}

Decorative icon with hidden accessibility label

When the icon is purely decorative next to visible text, hide it from assistive technology with aria-hidden.

decorative-icon-with-hidden-accessibility-label.tsx
import { FolderOpenIcon } from '@/components/icons/folder-open';export default function DecorativeExample() {  return (    <a href='/documents' className='inline-flex items-center gap-2'>      <FolderOpenIcon size={24} aria-hidden='true' />      <span>Documents</span>    </a>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the rendered SVG in pixels. The viewBox is always 0 0 24 24.
classNamestring—Class name applied to the outer wrapper div (passed through cn).
onMouseEnterMouseEventHandler<HTMLDivElement>—Called on mouse enter before the built-in animation starts. Forwarded from HTMLAttributes.
onMouseLeaveMouseEventHandler<HTMLDivElement>—Called on mouse leave. Forwarded from HTMLAttributes; with the current loops: false setting the animation is not reset on leave.
refRef<FolderOpenIconHandle>—Exposes startAnimation() and stopAnimation(). Attaching a ref switches the component to controlled mode, disabling automatic play on hover. stopAnimation() is a no-op because the icon does not loop.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes (id, role, aria-*, style, data-*, etc.) are spread onto the wrapper div.

Accessibility

  • The wrapper div and inner SVG have no default role or label; the icon is treated as an image only if you add role='img' and aria-label to the component, which are forwarded to the div.
  • For decorative use next to visible text, pass aria-hidden='true' so screen readers skip the icon.
  • The animation respects the user's prefers-reduced-motion setting via motion's useReducedMotion; when reduce is enabled, startAnimation returns without playing.
  • Hover-only animation provides no keyboard feedback; if the icon signals state, also convey that state through text or another non-motion cue.
  • The SVG uses an internal mask id generated with useId, so multiple instances on one page do not collide.

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-open" component (hugeicons-animated/folder-open) from its shadcn registry.1. Install it with: npx shadcn@latest add @hugeicons-animated/folder-open2. 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 { FolderOpenIcon } from '@/components/icons/folder-open';export function Example() {  return <FolderOpenIcon />;}```

Files & dependencies

  • icons/folder-open.tsx
  • lib/use-icon-animation.ts
dependenciesmotion

Looks similar, elsewhere