Chevron Down
An animated chevron-down icon built on motion/react that bounces downward when hovered or when startAnimation() is called through its ref. It is a drop-in replacement for a static chevron in dropdowns, accordions, and disclosure buttons.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
import { ChevronDownIcon } from "@/components/ui/chevron-down";export function Example() { return <ChevronDownIcon className="text-foreground" />;}- Use as the trigger indicator for dropdowns, selects, or accordion headers to signal that the content expands on hover or click.
- Use in navigation menus or buttons where a subtle hover micro-interaction adds polish without a large visual change.
- Use with the imperative ref (startAnimation / stopAnimation) to play the bounce programmatically, for example when a section opens or when keyboard focus lands on a control.
- Avoid when the chevron must remain perfectly static for dense data tables or in contexts where motion is distracting.
Examples
Hover-triggered bounce (default)
Renders the icon with no extra wiring. Hovering the wrapper div plays the bounce animation automatically.
import { ChevronDownIcon } from "@/components/ui/chevron-down";export function HoverChevron() { return ( <button type="button" className="inline-flex items-center gap-1 text-sm font-medium"> Options <ChevronDownIcon size={16} /> </button> );}Programmatic control via ref
Attaching the ref switches the icon into controlled mode, so hover no longer auto-plays. Call startAnimation and stopAnimation yourself, here tied to focus.
import { useRef } from "react";import { ChevronDownIcon, type ChevronDownIconHandle } from "@/components/ui/chevron-down";export function FocusChevron() { const iconRef = useRef<ChevronDownIconHandle>(null); return ( <button type="button" onFocus={() => iconRef.current?.startAnimation()} onBlur={() => iconRef.current?.stopAnimation()} className="inline-flex items-center gap-1 rounded-md border px-3 py-1.5 text-sm" > Sort by <ChevronDownIcon ref={iconRef} size={18} /> </button> );}Accordion-style disclosure header
Uses the icon as a disclosure indicator inside a toggle button, with aria-expanded set on the button. The icon is decorative, so it is hidden from assistive technology.
import { useState } from "react";import { ChevronDownIcon } from "@/components/ui/chevron-down";export function Disclosure({ title, children }: { title: string; children: React.ReactNode }) { const [open, setOpen] = useState(false); return ( <div className="border-b"> <button type="button" aria-expanded={open} onClick={() => setOpen((v) => !v)} className="flex w-full items-center justify-between py-3 text-left font-medium" > {title} <ChevronDownIcon size={20} aria-hidden="true" className="shrink-0" /> </button> {open && <div className="pb-3 text-sm">{children}</div>} </div> );}Custom color and size on a menu trigger
Colors come from Tailwind text utilities because the SVG uses currentColor. The size prop controls the SVG width and height.
import { ChevronDownIcon } from "@/components/ui/chevron-down";export function MenuTrigger() { return ( <div className="inline-flex items-center gap-2 rounded-full bg-indigo-600 px-4 py-2 text-white"> <span className="text-sm">Account</span> <ChevronDownIcon size={14} className="text-indigo-200" /> </div> );}API reference
Accessibility
- The SVG has no role, title, or aria-label. If the icon is purely decorative, pass aria-hidden="true" through props so it is hidden from screen readers, since the attribute lands on the wrapper div.
- If the icon conveys state (such as expanded or collapsed), communicate it on the interactive parent with aria-expanded or a visible label, not through the icon alone.
- The animation is mouse-driven by default and does not respond to keyboard focus. For keyboard users, call startAnimation() from onFocus through the ref, as shown in the examples.
- The motion is a short 2px bounce over about 0.5 seconds. For users with reduced-motion preferences, consider skipping startAnimation or using motion's useReducedMotion in your own wrapper, since the component does not check this itself.
- Color contrast depends on the inherited currentColor; ensure the parent text color meets WCAG contrast 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.
Use the "Chevron Down" component (lucide-animated/chevron-down) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/chevron-down.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, ...HTMLDivElement attributes.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { ChevronDownIcon } from "@/components/ui/chevron-down";export function Example() { return <ChevronDownIcon className="text-foreground" />;}```Files & dependencies
- chevron-down.tsx