file-add
An animated file-add icon built with motion/react that shows a document with a plus badge. Hovering plays a one-shot animation where the page lifts and squashes while the plus mark rotates in and settles, and a parent can trigger the same animation imperatively through a ref.
shadcn add · no workarounds · theme neutral (none shipped)Installation
Requires @hugeicons-animated in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { FileAddIcon } from '@/components/ui/file-add';<FileAddIcon />- Use for 'create new file', 'add document', or 'new item' actions in toolbars, menus, and empty states.
- Use when a subtle hover micro-interaction should reinforce a file-creation affordance without changing layout.
- Use when you need an icon that can be triggered programmatically (for example after a successful action) via its ref handle.
- Avoid for decorative icons that should not animate, or in contexts where motion must be disabled; the component already respects reduced motion but static icons are better for purely informational use.
Examples
Basic hover icon
Renders the icon with default size (28) and plays the animation on mouse enter.
import { FileAddIcon } from '@/components/ui/file-add';export function NewFileButtonIcon() { return <FileAddIcon />;}Imperative trigger via ref
Uses the exported FileAddIconHandle to start the animation programmatically, for example after a file is created. Hover handling is disabled while a ref is attached and controlled.
import { useRef } from 'react';import { FileAddIcon, type FileAddIconHandle } from '@/components/ui/file-add';export function CreateFileRow() { const iconRef = useRef<FileAddIconHandle>(null); return ( <div className="flex items-center gap-2"> <FileAddIcon ref={iconRef} size={20} /> <button type="button" onClick={() => iconRef.current?.startAnimation()} > Create file </button> </div> );}Sized and colored in a menu item
Sets a custom size and uses className to color the icon through currentColor.
import { FileAddIcon } from '@/components/ui/file-add';export function MenuItemNewFile() { return ( <button type="button" className="flex items-center gap-2 text-sm"> <FileAddIcon size={18} className="text-blue-600" /> New document </button> );}Labeled icon with accessible name
Wraps the icon in a labeled element so screen readers announce the purpose, since the SVG itself has no text alternative.
import { FileAddIcon } from '@/components/ui/file-add';export function NewFileIconButton() { return ( <button type="button" aria-label="Add new file" className="p-2 rounded-md hover:bg-muted"> <FileAddIcon size={24} aria-hidden="true" /> </button> );}API reference
Accessibility
- The SVG has no title, desc, or role, so the icon is not announced by screen readers on its own; provide an aria-label on a parent button or link, or add role="img" and aria-label on the wrapper via props.
- If the icon is purely decorative next to visible text, pass aria-hidden="true" through props so it is ignored by assistive technology.
- Animations respect the user's prefers-reduced-motion setting: useReducedMotion causes startAnimation to return early, so no motion plays for those users.
- Because the animation is hover-only by default, do not rely on it to convey state; use ref-triggered animation or visible text for important feedback.
- Keep the icon inside an interactive element that is focusable and has a visible focus style, since the wrapper div itself is not focusable.
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 "file-add" component (hugeicons-animated/file-add) from its shadcn registry.1. Install it with: npx shadcn@latest add @hugeicons-animated/file-add2. 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, ...HTMLAttributes<HTMLDivElement>.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { FileAddIcon } from '@/components/ui/file-add';<FileAddIcon />```Files & dependencies
- icons/file-add.tsx
- lib/use-icon-animation.ts