bars-3-center-left

An animated hamburger-style menu icon with three horizontal bars where the top and bottom bars slide sideways and the center bar shortens and bounces. It animates on hover by default and can also be driven programmatically through a ref.

bars-3-center-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 @heroicons-animated/bars-3-center-left

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

Usage

usage.tsx
import { Bars3CenterLeftIcon } from "@/components/ui/bars-3-center-left";export function Example() {  return <Bars3CenterLeftIcon size={28} className="text-foreground" />;}
  • Use as a navigation or menu toggle in headers, sidebars, or mobile drawers where a playful hover cue is wanted.
  • Use when you need a list or document-style icon that conveys text alignment or left-aligned content with motion.
  • Use when you want to trigger the animation programmatically, such as when a menu opens, by calling the ref handle.
  • Avoid in dense UIs where constant micro-motion could be distracting, or where a static icon is required.

Examples

Hover-driven menu icon

Default behavior: the icon animates on mouse enter and returns to rest on mouse leave. No ref is needed.

hover-driven-menu-icon.tsx
import { Bars3CenterLeftIcon } from "@/components/ui/bars-3-center-left";export function HeaderMenuIcon() {  return (    <button type="button" aria-label="Open menu" className="p-2">      <Bars3CenterLeftIcon size={24} />    </button>  );}

Programmatic control via ref

Attach a ref to start and stop the animation from parent handlers. The ref handle exposes startAnimation and stopAnimation.

programmatic-control-via-ref.tsx
import { useRef } from "react";import { Bars3CenterLeftIcon, type Bars3CenterLeftIconHandle } from "@/components/ui/bars-3-center-left";export function MenuButton() {  const ref = useRef<Bars3CenterLeftIconHandle>(null);  return (    <button      type="button"      aria-label="メニュー"      onMouseEnter={() => ref.current?.startAnimation()}      onMouseLeave={() => ref.current?.stopAnimation()}      className="p-2"    >      <Bars3CenterLeftIcon ref={ref} size={24} />    </button>  );}

Colored and sized icon

Use className for color through currentColor and size for the rendered SVG dimensions.

colored-and-sized-icon.tsx
import { Bars3CenterLeftIcon } from "@/components/ui/bars-3-center-left";export function ColoredMenuIcon() {  return <Bars3CenterLeftIcon size={32} className="text-emerald-500 hover:text-emerald-600" />;}

API reference

PropTypeDefaultDescription
sizenumber28Width and height in pixels applied to the inner SVG.
classNamestring—Class names applied to the wrapping div, passed through cn(). Use it to set color (currentColor) and layout.
onMouseEnter(e: React.MouseEvent<HTMLDivElement>) => void—Mouse enter handler. When the ref handle is attached, this is called instead of the built-in hover animation.
onMouseLeave(e: React.MouseEvent<HTMLDivElement>) => void—Mouse leave handler. When the ref handle is attached, this is called instead of the built-in hover animation.
refReact.Ref<Bars3CenterLeftIconHandle>—Exposes Bars3CenterLeftIconHandle with startAnimation() (plays the animate state) and stopAnimation() (returns to the normal state).
...HTMLAttributes<HTMLDivElement>HTMLAttributes<HTMLDivElement>—All other standard div attributes (id, style, aria-*, data-*, etc.) are spread onto the wrapping div.

Accessibility

  • The icon is decorative SVG with no title or role; when it conveys meaning, place it inside an element with an accessible name such as a button with aria-label.
  • Interactive usage should wrap the icon in a button or link, not rely on the div hover alone, so keyboard and touch users can reach the control.
  • Respect reduced-motion preferences by disabling or shortening the animation in your app if needed, since the icon moves on hover by default.
  • Ensure sufficient contrast by setting color via className, because the stroke uses currentColor.

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-3-center-left" component (heroicons-animated/bars-3-center-left) from its shadcn registry.1. Install it with: npx shadcn@latest add @heroicons-animated/bars-3-center-left2. 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 { Bars3CenterLeftIcon } from "@/components/ui/bars-3-center-left";export function Example() {  return <Bars3CenterLeftIcon size={28} className="text-foreground" />;}```

Files & dependencies

  • bars-3-center-left.tsx
dependenciesmotion

Looks similar, elsewhere