File Text
An animated file-text icon for React built on motion/react, drawing a document outline whose three text lines wipe and retract in sequence on hover. It can also be driven programmatically through a ref exposing startAnimation and stopAnimation.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
import { FileTextIcon } from "@/components/ui/file-text";export function Example() { return <FileTextIcon />;}- Show a document, note, report, or text-content indicator in navigation, menus, or file lists with a subtle hover animation.
- Add a lively 'writing' or 'drafting' cue to a button, card, or list item that represents text or articles.
- Trigger the text-writing animation from parent code (e.g. on upload start or on a tab becoming active) via the imperative ref handle.
- Use as a lightweight decorative icon where a Lucide-style file-text glyph is wanted with motion, without managing animation state yourself.
Examples
Icon inside a navigation link
Hover the link to play the text-line animation; the icon inherits color from the surrounding text.
import { FileTextIcon } from "@/components/ui/file-text";export function DocsNavItem() { return ( <a href="/docs" className="flex items-center gap-2 text-sm text-neutral-700 hover:text-neutral-900"> <FileTextIcon size={20} /> <span>Documentation</span> </a> );}Programmatic control via ref
Start and stop the animation from parent code using the exposed handle. Hover handling is bypassed once the ref is attached.
import { useRef } from "react";import { FileTextIcon, type FileTextIconHandle } from "@/components/ui/file-text";export function SavingNote() { const iconRef = useRef<FileTextIconHandle>(null); return ( <div className="flex items-center gap-2" onMouseEnter={() => iconRef.current?.startAnimation()} onMouseLeave={() => iconRef.current?.stopAnimation()} > <FileTextIcon ref={iconRef} size={24} className="text-blue-600" /> <span>Draft notes</span> </div> );}Larger themed icon in a card header
Pass a custom size and Tailwind color classes; the stroke uses currentColor so the color follows the class.
import { FileTextIcon } from "@/components/ui/file-text";export function ArticleCardHeader() { return ( <div className="flex items-center gap-3 rounded-lg border p-4"> <FileTextIcon size={40} className="text-emerald-600" /> <div> <h3 className="font-semibold">Quarterly report</h3> <p className="text-sm text-muted-foreground">Updated today</p> </div> </div> );}API reference
Accessibility
- The icon is decorative by default; when it conveys meaning on its own, wrap it or pass aria-label and role="img" via the spread div props.
- When the icon sits beside visible text, add aria-hidden="true" so screen readers do not announce it redundantly.
- The animation is purely visual and scale changes are subtle (1.05), but consider respecting prefers-reduced-motion by avoiding programmatic startAnimation calls for users who opt out.
- The wrapper is a div with mouse handlers only; it is not focusable or keyboard-operable, so do not rely on hover alone to reveal essential information.
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 Text" component (lucide-animated/file-text) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/file-text.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 { FileTextIcon } from "@/components/ui/file-text";export function Example() { return <FileTextIcon />;}```Files & dependencies
- file-text.tsx