Chevrons Down Up

An animated chevrons-down-up icon built on motion/react. Two chevrons sit at the top and bottom of a 24x24 SVG and spring toward the center on hover, then return when the pointer leaves or when the imperative handle is called.

Chevrons Down 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 https://lucide-animated.com/r/chevrons-down-up.json

Usage

usage.tsx
import { ChevronsDownUpIcon } from "@/components/ui/chevrons-down-up";export default function Demo() {  return <ChevronsDownUpIcon size={32} className="text-foreground" />;}
  • Collapse, compress, or condense actions such as 'collapse all', 'compact view', or 'fit content'.
  • Icon buttons in toolbars, table headers, or sidebars that need a subtle hover micro-interaction.
  • Controlled animations, for example syncing the icon with a row-collapse state through the exposed startAnimation and stopAnimation handle.
  • Marketing or dashboard UI where a small, playful motion accent is wanted without a heavy animation library.

Examples

Hover-triggered icon

Uncontrolled usage. The icon animates automatically on mouse enter and mouse leave.

hover-triggered-icon.tsx
import { ChevronsDownUpIcon } from "@/components/ui/chevrons-down-up";export function Collapsible() {  return (    <div className="flex items-center gap-2 text-sm">      <ChevronsDownUpIcon size={20} className="text-zinc-600 dark:text-zinc-300" />      <span>Collapse all</span>    </div>  );}

Controlled via ref from an icon button

Attaching a ref switches the icon to controlled mode. The parent button drives the animation with startAnimation and stopAnimation.

controlled-via-ref-from-an-icon-button.tsx
"use client";import { useRef } from "react";import { Button } from "@/components/ui/button";import { ChevronsDownUpIcon, type ChevronsDownUpIconHandle } from "@/components/ui/chevrons-down-up";export function CollapseButton() {  const iconRef = useRef<ChevronsDownUpIconHandle>(null);  return (    <Button      variant="ghost"      size="icon"      aria-label="Collapse all"      onMouseEnter={() => iconRef.current?.startAnimation()}      onMouseLeave={() => iconRef.current?.stopAnimation()}    >      <ChevronsDownUpIcon ref={iconRef} />    </Button>  );}

Call-to-action button with icon

A primary button where the icon animates on hover through the button's group context, using a custom className for color.

call-to-action-button-with-icon.tsx
import { Button } from "@/components/ui/button";import { ChevronsDownUpIcon } from "@/components/ui/chevrons-down-up";export function CompactButton() {  return (    <Button className="group gap-2">      <ChevronsDownUpIcon size={16} className="text-primary-foreground" />      Compact view    </Button>  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels. Applied to both the width and height attributes of the svg element.
classNamestring—Class names applied to the outer div wrapper. Use text-* utilities to change the stroke color, since the stroke is currentColor.
refReact.Ref<ChevronsDownUpIconHandle>—Forwarded ref exposing startAnimation() and stopAnimation(). Attaching a ref switches the component to controlled mode, where the built-in mouse handlers defer to the onMouseEnter and onMouseLeave props instead of animating on their own.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes (id, style, aria-*, data-*, onClick, and so on) are spread onto the outer wrapper div. onMouseEnter and onMouseLeave are intercepted by the component and only used in controlled mode.

Accessibility

  • The icon is decorative. If it conveys meaning on its own, add an accessible name on the parent interactive element, for example aria-label="Collapse all" on a button.
  • The wrapper is a plain div and the svg has no role or aria-hidden attribute. When used inside a labelled button, consider adding aria-hidden="true" to the icon through props so that screen readers do not announce it twice.
  • The icon is not focusable. Keyboard users cannot trigger the hover animation, so do not rely on the animation alone to communicate state. Pair it with a visible label or a state change.
  • The component does not check prefers-reduced-motion. If motion sensitivity matters in your app, skip calling startAnimation or wrap the animation in a media query check.
  • Contrast depends on the stroke color supplied through className. Make sure the chosen color meets WCAG 3:1 contrast against the background for non-text graphics.

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 "Chevrons Down Up" component (lucide-animated/chevrons-down-up) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/chevrons-down-up.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, ref, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { ChevronsDownUpIcon } from "@/components/ui/chevrons-down-up";export default function Demo() {  return <ChevronsDownUpIcon size={32} className="text-foreground" />;}```

Files & dependencies

  • chevrons-down-up.tsx
dependenciesmotion

Looks similar, elsewhere