arrow-left-end-on-rectangle
An animated outline icon of a left-pointing arrow leaving a rectangular door or frame, used to represent logout or exit. On hover, the arrow nudges left and returns, and a ref handle lets you trigger the same animation programmatically.
shadcn add · no workarounds · theme neutral (none shipped)Installation
Requires @heroicons-animated in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { ArrowLeftEndOnRectangleIcon } from '@/components/ui/arrow-left-end-on-rectangle';export function Example() { return <ArrowLeftEndOnRectangleIcon />;}- Logout, sign-out, or exit actions in navigation menus, sidebars, and account dropdowns.
- Buttons or links that represent leaving a session, room, or workspace.
- Places where a subtle hover micro-interaction should reinforce an exit affordance without looping.
- Interfaces that need to trigger the arrow nudge from code, for example when a menu item is focused, by using the ref handle.
Examples
Basic hover icon
Renders the icon at the default 28px size. Hovering over it plays the arrow nudge animation.
import { ArrowLeftEndOnRectangleIcon } from '@/components/ui/arrow-left-end-on-rectangle';export default function BasicExample() { return ( <div className='text-zinc-900 dark:text-zinc-100'> <ArrowLeftEndOnRectangleIcon /> </div> );}Logout button with custom size
Uses the size prop and a Tailwind className on the wrapper div so the icon inherits color and hover styles from the button.
import { ArrowLeftEndOnRectangleIcon } from '@/components/ui/arrow-left-end-on-rectangle';export default function LogoutButton() { return ( <button type='button' className='inline-flex items-center gap-2 rounded-md px-3 py-2 text-sm text-red-600 hover:bg-red-50' > <ArrowLeftEndOnRectangleIcon size={20} /> Sign out </button> );}Programmatic control via ref
Passing a ref switches the component to controlled mode. Hover no longer auto-plays the animation; call startAnimation and stopAnimation from the ref handle instead.
import { useRef } from 'react';import { ArrowLeftEndOnRectangleIcon, type ArrowLeftEndOnRectangleIconHandle,} from '@/components/ui/arrow-left-end-on-rectangle';export default function ControlledExample() { const iconRef = useRef<ArrowLeftEndOnRectangleIconHandle>(null); return ( <div onFocus={() => iconRef.current?.startAnimation()} onBlur={() => iconRef.current?.stopAnimation()} tabIndex={0} > <ArrowLeftEndOnRectangleIcon ref={iconRef} size={24} /> </div> );}Menu item with keyboard-triggered animation
Plays the animation when the menu item receives keyboard focus and stops when focus leaves, using the same ref handle.
import { useRef } from 'react';import { ArrowLeftEndOnRectangleIcon, type ArrowLeftEndOnRectangleIconHandle,} from '@/components/ui/arrow-left-end-on-rectangle';export default function MenuItem() { const iconRef = useRef<ArrowLeftEndOnRectangleIconHandle>(null); return ( <a href='/logout' role='menuitem' className='flex items-center gap-3 px-3 py-2 focus:bg-zinc-100' onFocus={() => iconRef.current?.startAnimation()} onBlur={() => iconRef.current?.stopAnimation()} > <ArrowLeftEndOnRectangleIcon ref={iconRef} size={18} /> <span>Log out</span> </a> );}API reference
Accessibility
- The SVG has no title, desc, or role, so it is decorative by default. When the icon is the only content of a control, add aria-label to the button or link, or visually hidden text, and keep the icon itself aria-hidden where appropriate.
- Put aria-hidden on the wrapper through props when the label already appears as visible text, for example in a 'Sign out' button.
- The hover animation is a small 0.5s translation and does not convey essential information. Do not rely on it alone to communicate state.
- Respect prefers-reduced-motion by gating startAnimation calls or passing a no-op handler in user-preference contexts, since the component does not check this media query itself.
- Because the wrapper is a div, place it inside an interactive element such as a button or link rather than making the div itself the focus target.
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 "arrow-left-end-on-rectangle" component (heroicons-animated/arrow-left-end-on-rectangle) from its shadcn registry.1. Install it with: npx shadcn@latest add @heroicons-animated/arrow-left-end-on-rectangle2. 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 { ArrowLeftEndOnRectangleIcon } from '@/components/ui/arrow-left-end-on-rectangle';export function Example() { return <ArrowLeftEndOnRectangleIcon />;}```Files & dependencies
- arrow-left-end-on-rectangle.tsx