bars-arrow-down

An animated bars-arrow-down icon that draws three horizontal bars with a downward arrow at the right, and nudges the arrow down briefly on hover. It is a client component built on motion/react and can also be driven imperatively through a ref.

bars-arrow-down
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/bars-arrow-down

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

Usage

usage.tsx
import { BarsArrowDownIcon } from '@/components/ui/bars-arrow-down';export function Example() {  return <BarsArrowDownIcon size={24} className='text-neutral-700' />;}
  • Use as a sort-descending or order-by control in table headers, filter bars, or list toolbars.
  • Use to signal a downward-ordered list or a 'sort by' menu item in dropdowns and command palettes.
  • Use as a subtle hover-animated affordance in navigation or toolbar buttons where a static icon would feel flat.
  • Avoid when the icon must communicate a plain 'download' or 'move down' action without an ordering meaning.

Examples

Sort button with hover animation

Uses the default hover behavior. The icon animates on mouse enter and resets on mouse leave without any extra wiring.

sort-button-with-hover-animation.tsx
import { BarsArrowDownIcon } from '@/components/ui/bars-arrow-down';export function SortButton() {  return (    <button type='button' className='inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm'>      <BarsArrowDownIcon size={20} />      Sort    </button>  );}

Controlled animation via ref

Passing a ref switches the icon to controlled mode: its own hover handlers only call the props you supply, so you decide when startAnimation and stopAnimation run.

controlled-animation-via-ref.tsx
import { useRef } from 'react';import { BarsArrowDownIcon, type BarsArrowDownIconHandle } from '@/components/ui/bars-arrow-down';export function SortColumnHeader() {  const iconRef = useRef<BarsArrowDownIconHandle>(null);  return (    <th      onMouseEnter={() => iconRef.current?.startAnimation()}      onMouseLeave={() => iconRef.current?.stopAnimation()}    >      <div className='flex items-center gap-1'>        Date        <BarsArrowDownIcon ref={iconRef} size={16} />      </div>    </th>  );}

Sized and labeled icon

Changes the rendered SVG size and passes an accessible label through to the wrapper div, since extra HTML attributes are spread onto it.

sized-and-labeled-icon.tsx
import { BarsArrowDownIcon } from '@/components/ui/bars-arrow-down';export function SortAscendingLabel() {  return (    <BarsArrowDownIcon      size={32}      className='text-emerald-600'      role='img'      aria-label='Sort descending'    />  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the rendered SVG in pixels. Applied to both the width and height attributes.
classNamestring—Additional class names applied to the outer wrapper div, passed through cn().
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Mouse enter handler on the wrapper div. In uncontrolled mode it is not called by the icon's own animation logic; in controlled mode (ref attached) it is invoked instead of the built-in animation.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Mouse leave handler on the wrapper div. Behaves like onMouseEnter: called instead of the built-in reset animation when the ref is attached.
refReact.Ref<BarsArrowDownIconHandle>—Forwarded ref exposing startAnimation() and stopAnimation(). Attaching it switches the icon into controlled mode.
...HTMLAttributes<HTMLDivElement>HTMLAttributes<HTMLDivElement>—All other standard div attributes (id, role, aria-*, style, onClick, etc.) are spread onto the wrapper div.

Accessibility

  • The SVG has no title or desc element, so the icon is not announced by default. Give the wrapper an aria-label and role='img' when the icon conveys meaning, for example 'Sort descending'.
  • If the icon is purely decorative next to visible text, add aria-hidden='true' so screen readers skip it.
  • The wrapper div is not focusable and carries no keyboard behavior; the animation is hover-only, so keyboard users get no visual feedback unless the parent control also responds to focus and calls startAnimation through the ref.
  • Respect reduced-motion preferences by calling stopAnimation or skipping startAnimation when prefers-reduced-motion is set, since the bounce is a continuous motion effect.
  • Icon color comes from currentColor, so ensure the parent text color meets contrast requirements against its 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 "bars-arrow-down" component (heroicons-animated/bars-arrow-down) from its shadcn registry.1. Install it with: npx shadcn@latest add @heroicons-animated/bars-arrow-down2. 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 { BarsArrowDownIcon } from '@/components/ui/bars-arrow-down';export function Example() {  return <BarsArrowDownIcon size={24} className='text-neutral-700' />;}```

Files & dependencies

  • bars-arrow-down.tsx
dependenciesmotion

Looks similar, elsewhere