Align Left

An animated Lucide-style "align left" icon in which three horizontal lines of different lengths stretch and retract when hovered. It is a React component built on Motion, and it can also be started and stopped programmatically through a ref.

Align Left
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/align-left.json

Usage

usage.tsx
import { AlignLeftIcon } from "@/components/ui/align-left";<AlignLeftIcon />
  • Adding a text-alignment or formatting control such as a left-align button in an editor toolbar or menu.
  • Adding a subtle hover micro-interaction to navigation, list, or settings items that show alignment or text layout.
  • Using an animated icon as a visual indicator that can be triggered by application state through a ref (for example, while content is being processed).
  • Replacing a static icon with a lively one in landing pages or marketing UI where a playful, polished feel is wanted.

Examples

Hover animation in a toolbar button

Default hover-driven usage. The icon animates on mouse enter and resets on mouse leave, and it inherits its color from the button's text color.

hover-animation-in-a-toolbar-button.tsx
import { AlignLeftIcon } from "@/components/ui/align-left";export function AlignLeftButton() {  return (    <button type="button" className="inline-flex items-center gap-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent">      <AlignLeftIcon size={16} />      Align left    </button>  );}

Programmatic control through a ref

Attach a ref to start and stop the animation from code. Once a ref is attached, the icon no longer animates on its own hover, so the hover handlers should be wired up in the parent.

programmatic-control-through-a-ref.tsx
"use client";import { useRef } from "react";import { AlignLeftIcon, type AlignLeftIconHandle } from "@/components/ui/align-left";export function AlignRow() {  const iconRef = useRef<AlignLeftIconHandle>(null);  return (    <div      onMouseEnter={() => iconRef.current?.startAnimation()}      onMouseLeave={() => iconRef.current?.stopAnimation()}      className="inline-flex cursor-pointer items-center"    >      <AlignLeftIcon ref={iconRef} size={20} />    </div>  );}

Custom color and size

Use className to set the color, since the stroke uses currentColor, and use size to change the rendered width and height.

custom-color-and-size.tsx
import { AlignLeftIcon } from "@/components/ui/align-left";export function AccentAlignLeft() {  return <AlignLeftIcon size={32} className="text-emerald-500" />;}

Labeled icon for screen readers

Provide an accessible name with aria-label and role="img" when the icon conveys meaning on its own.

labeled-icon-for-screen-readers.tsx
import { AlignLeftIcon } from "@/components/ui/align-left";export function LabeledAlignLeft() {  return <AlignLeftIcon role="img" aria-label="Align text left" size={24} />;}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the rendered SVG in pixels. The viewBox stays 0 0 24 24.
classNamestring—Class names applied to the outer div wrapper (passed through cn). Use it to set color with text-* utilities or to add layout classes.
refReact.Ref<AlignLeftIconHandle>—Forwarded ref exposing startAnimation() and stopAnimation(). Attaching a ref switches the component to controlled mode, so built-in hover animation is disabled and onMouseEnter/onMouseLeave are only forwarded to the props.
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Mouse-enter handler from HTMLAttributes. In uncontrolled mode the component starts the animation first; in controlled mode it is only called.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Mouse-leave handler from HTMLAttributes. In uncontrolled mode the component resets the animation first; in controlled mode it is only called.
...HTMLAttributes<HTMLDivElement>React.HTMLAttributes<HTMLDivElement>—All other standard div attributes (for example id, style, role, aria-*, data-*) are spread onto the outer wrapper div.

Accessibility

  • The SVG has no title or aria-label by default, so when the icon is the only content of a control, put aria-label on the button or on the icon wrapper.
  • If the icon is decorative (for example next to visible text), add aria-hidden="true" so screen readers skip it.
  • When the icon carries meaning alone, pass role="img" and an aria-label; these are forwarded to the wrapper div.
  • The animation is purely visual and does not change content. Respect reduced motion preferences by disabling or shortening the animation in your app if needed.
  • Keep the icon at a size where it stays legible, and make sure the interactive parent has a visible focus style, since the icon itself is not focusable.

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 "Align Left" component (lucide-animated/align-left) from its shadcn registry.1. Install it with: npx shadcn@latest add https://lucide-animated.com/r/align-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, ref, onMouseEnter, onMouseLeave, ...HTMLAttributes<HTMLDivElement>.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { AlignLeftIcon } from "@/components/ui/align-left";<AlignLeftIcon />```

Files & dependencies

  • align-left.tsx
dependenciesmotion

Looks similar, elsewhere