arrow-down-tray
ArrowDownTrayIcon is an animated download icon for React: a tray outline with a downward arrow that bounces briefly on hover. It can also be driven imperatively through a ref with startAnimation and stopAnimation.
shadcn add · no workarounds · theme neutral (none shipped)Installation
Requires @heroicons-animated in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { ArrowDownTrayIcon } from "@/components/ui/arrow-down-tray";export function Example() { return <ArrowDownTrayIcon size={24} className="text-zinc-700" />;}- Download buttons, export actions, or 'save to device' links where a subtle hover cue helps users recognize the action.
- Inline download affordances in tables, cards, or file lists that need a lightweight animated icon without a full icon library.
- Interactive controls that should animate on demand, such as a button that plays the arrow motion while a download starts, by calling the ref handle.
- Places where the icon should follow the current text color and scale through a numeric size prop.
Examples
Hover-animated download button
The icon animates automatically when the pointer enters its wrapper div. The icon takes its color from the button's text color.
import { ArrowDownTrayIcon } from "@/components/ui/arrow-down-tray";export function DownloadButton() { return ( <button type="button" className="inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm" > <ArrowDownTrayIcon size={20} /> Download </button> );}Imperative control via ref
Attach a ref to the icon to call startAnimation and stopAnimation from a parent. Here the parent row starts the animation on hover.
import { useRef } from "react";import { ArrowDownTrayIcon, type ArrowDownTrayIconHandle,} from "@/components/ui/arrow-down-tray";export function SaveRow() { const iconRef = useRef<ArrowDownTrayIconHandle>(null); return ( <div className="flex items-center gap-2" onMouseEnter={() => iconRef.current?.startAnimation()} onMouseLeave={() => iconRef.current?.stopAnimation()} > <ArrowDownTrayIcon ref={iconRef} size={24} /> <span>Save file</span> </div> );}Accessible icon-only download action
For an icon-only control, put the accessible name on the button and hide the decorative icon from assistive technology.
import { ArrowDownTrayIcon } from "@/components/ui/arrow-down-tray";export function IconDownloadButton({ onDownload }: { onDownload: () => void }) { return ( <button type="button" aria-label="Download file" onClick={onDownload} className="rounded-md p-2 hover:bg-zinc-100" > <ArrowDownTrayIcon size={20} aria-hidden="true" /> </button> );}API reference
Accessibility
- The SVG has no title, role, or aria-label, so it is exposed as unnamed graphics. Pass aria-label or aria-hidden on the wrapper, or aria-hidden on the icon when a text label is present.
- For icon-only buttons, give the button an aria-label such as 'Download file' and mark the icon aria-hidden="true".
- The hover motion is a small 2px vertical movement and carries no essential meaning, so the action must be conveyed by text or label, not by the animation.
- The component does not check prefers-reduced-motion. If you need to respect that setting, skip calling startAnimation or override the animation in your own wrapper.
- Imperative handles let keyboard and touch users trigger the same motion from focus or tap handlers, which keeps the cue available beyond mouse hover.
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 "arrow-down-tray" component (heroicons-animated/arrow-down-tray) from its shadcn registry.1. Install it with: npx shadcn@latest add @heroicons-animated/arrow-down-tray2. 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 { ArrowDownTrayIcon } from "@/components/ui/arrow-down-tray";export function Example() { return <ArrowDownTrayIcon size={24} className="text-zinc-700" />;}```Files & dependencies
- arrow-down-tray.tsx