bars-arrow-up

An animated bars-arrow-up icon built with motion/react that draws three horizontal lines with an upward arrow on the right, where the arrow bobs upward on hover or when controlled imperatively. It is a forwardRef component exposing startAnimation and stopAnimation through a ref handle.

bars-arrow-up
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-up

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

Usage

usage.tsx
import { BarsArrowUpIcon } from "@/components/ui/bars-arrow-up";export default function Example() {  return <BarsArrowUpIcon size={28} />;}
  • Sorting or ascending-order controls in tables, lists, or filter toolbars
  • Menu or navigation buttons where a quick hover cue suggests upward sorting or ordering
  • Toolbar actions that need a small, subtle animated icon instead of a static glyph
  • Imperative triggers where a parent component should play the arrow animation via a ref, for example after a successful sort

Examples

Sort button with hover animation

Hover over the icon inside a sort button to play the arrow bob animation. The default uncontrolled behavior is used.

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

Imperative control via ref

A parent component starts and stops the animation through the exposed handle, for example when a sort is applied.

imperative-control-via-ref.tsx
"use client";import { useRef } from "react";import { BarsArrowUpIcon, type BarsArrowUpIconHandle } from "@/components/ui/bars-arrow-up";export default function ControlledSort() {  const iconRef = useRef<BarsArrowUpIconHandle>(null);  return (    <div>      <BarsArrowUpIcon ref={iconRef} size={24} />      <button type="button" onClick={() => iconRef.current?.startAnimation()}>        Play      </button>      <button type="button" onClick={() => iconRef.current?.stopAnimation()}>        Reset      </button>    </div>  );}

Colored icon via className

The icon uses currentColor, so Tailwind text color utilities change its stroke color. The className is applied to the wrapping div.

colored-icon-via-classname.tsx
import { BarsArrowUpIcon } from "@/components/ui/bars-arrow-up";export default function ColoredSortIcon() {  return <BarsArrowUpIcon className="text-blue-600" size={32} />;}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels. Applied to both the svg width and height attributes.
classNamestring—Class name applied to the wrapping div element via cn().
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Mouse enter handler. When the ref handle is attached, the component calls this instead of starting the hover animation automatically.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Mouse leave handler. When the ref handle is attached, the component calls this instead of resetting the animation automatically.
refReact.Ref<BarsArrowUpIconHandle>—Forwarded ref exposing startAnimation() and stopAnimation() to control the animation imperatively. Attaching it switches the component to controlled mode, disabling automatic hover animation.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes are spread onto the wrapping div, such as id, style, aria-label, and event handlers.

Accessibility

  • The SVG has no title or role attribute, so give the wrapping element an aria-label or visible text such as "Sort ascending" when the icon is used alone.
  • If the icon is decorative beside visible text, pass aria-hidden="true" through props to the wrapping div so screen readers skip it.
  • Animation is a small 2-unit vertical movement over 0.5 seconds; if the user prefers reduced motion, avoid triggering startAnimation automatically.
  • Hover-only animation gives no feedback to keyboard or touch users, so pair it with a clear focus style on the parent button and rely on the label for meaning.
  • The icon inherits currentColor, so ensure the surrounding text color meets contrast requirements against the 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-up" component (heroicons-animated/bars-arrow-up) from its shadcn registry.1. Install it with: npx shadcn@latest add @heroicons-animated/bars-arrow-up2. 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 { BarsArrowUpIcon } from "@/components/ui/bars-arrow-up";export default function Example() {  return <BarsArrowUpIcon size={28} />;}```

Files & dependencies

  • bars-arrow-up.tsx
dependenciesmotion

Looks similar, elsewhere