Square Chevron Left
An animated square-chevron-left icon: a rounded square outline with a left-pointing chevron that nudges left when hovered. It is a client component built on motion/react, and it exposes a ref handle so parents can trigger the animation manually.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Usage
import { SquareChevronLeftIcon } from "@/components/ui/square-chevron-left";export default function Example() { return <SquareChevronLeftIcon />;}- Back, previous, or collapse controls in navigation bars, carousels, and sidebars where a boxed chevron fits the visual language.
- Micro-interactions on buttons or links that should signal leftward movement on hover.
- Lucide-style icon sets in dashboards or marketing pages that need a subtle animated alternative to a static icon.
- Imperative animation triggers, such as animating the icon when a related action starts or stops, by using the exposed ref handle.
Examples
Basic hover animation
Default usage. The icon animates on mouse enter and resets on mouse leave, with no extra wiring.
import { SquareChevronLeftIcon } from "@/components/ui/square-chevron-left";export default function Demo() { return <SquareChevronLeftIcon className="text-foreground" />;}Controlled animation via ref
Use the ref handle to start and stop the animation from a parent button. When a ref is attached, the component defers mouse handling to the onMouseEnter and onMouseLeave props on the icon.
"use client";import { useRef } from "react";import { Button } from "@/components/ui/button";import { SquareChevronLeftIcon, type SquareChevronLeftIconHandle } from "@/components/ui/square-chevron-left";export function BackButton() { const ref = useRef<SquareChevronLeftIconHandle>(null); return ( <Button variant="ghost" aria-label="Go back" onMouseEnter={() => ref.current?.startAnimation()} onMouseLeave={() => ref.current?.stopAnimation()} > <SquareChevronLeftIcon size={20} /> </Button> );}Custom size and color
The size prop sets both the width and height of the SVG. Color comes from the className, which applies through currentColor.
import { SquareChevronLeftIcon } from "@/components/ui/square-chevron-left";export default function Demo() { return <SquareChevronLeftIcon size={48} className="text-blue-500" />;}Decorative icon inside a link
Marks the icon as decorative with aria-hidden so screen readers rely on the visible link text.
import { SquareChevronLeftIcon } from "@/components/ui/square-chevron-left";export default function PrevLink() { return ( <a href="/previous" className="inline-flex items-center gap-2"> <SquareChevronLeftIcon size={24} aria-hidden="true" /> <span>Previous</span> </a> );}API reference
Accessibility
- The SVG has no role or aria-label, so it is exposed as nothing to assistive technology. If the icon is purely decorative, add aria-hidden="true". This is the usual choice when visible text is present.
- If the icon is the only content of a control, put aria-label on the interactive parent such as a button or link (for example aria-label="Go back"). Do not add aria-label to the bare icon, because the wrapper div has no role.
- The wrapper div is not focusable and has no keyboard behavior. Hover-triggered animation has no keyboard equivalent, so do not rely on it to convey state. Use the ref handle to tie the animation to focus or other keyboard-driven events when needed.
- The component does not check prefers-reduced-motion. If motion sensitivity matters for your product, gate startAnimation calls with a media query check in the parent.
- The animation is a short horizontal nudge of about 2 units that loops once per trigger. It does not flash or blink, so it is unlikely to cause seizure risk.
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 "Square Chevron Left" component (lucide-animated/square-chevron-left) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/square-chevron-left.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, ...HTMLAttributes<HTMLDivElement>.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { SquareChevronLeftIcon } from "@/components/ui/square-chevron-left";export default function Example() { return <SquareChevronLeftIcon />;}```Files & dependencies
- square-chevron-left.tsx