command-line
An animated command-line icon for React: a terminal window outline with a prompt chevron, where the cursor line blinks on hover. It is built with motion and can also be driven imperatively through a ref.
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 { CommandLineIcon } from '@/components/ui/command-line';export function Example() { return <CommandLineIcon size={28} className='text-foreground' />;}- Use it for terminal, CLI, developer tool, or code-execution features such as 'Run', 'Console', or 'Open terminal' buttons.
- Use it in navigation items or action buttons that need a subtle, looping hover animation.
- Use the ref handle when the blinking should be tied to app state, such as while a command is running.
Examples
Hover-driven icon in a navigation link
The default hover behavior needs no extra code. The icon blinks while the pointer is over its wrapper and returns to steady when the pointer leaves.
import { CommandLineIcon } from '@/components/ui/command-line';export function TerminalLink() { return ( <a href='/terminal' className='flex items-center gap-2 text-sm'> <CommandLineIcon size={20} /> Terminal </a> );}Controlled animation through the ref handle
Attach a ref and call startAnimation and stopAnimation from your own handlers. Once the ref is attached, the icon stops responding to its built-in hover behavior and only forwards mouse events to your handlers.
import { useRef } from 'react';import { CommandLineIcon, type CommandLineIconHandle } from '@/components/ui/command-line';export function RunButton() { const iconRef = useRef<CommandLineIconHandle>(null); return ( <button type='button' className='inline-flex items-center gap-2' onMouseEnter={() => iconRef.current?.startAnimation()} onMouseLeave={() => iconRef.current?.stopAnimation()} > <CommandLineIcon ref={iconRef} size={20} /> Run </button> );}Decorative icon next to a labeled control
When the visible text already names the action, hide the icon from assistive technology.
import { CommandLineIcon } from '@/components/ui/command-line';export function OpenConsoleButton() { return ( <button type='button' className='inline-flex items-center gap-2 rounded-md border px-3 py-1.5'> <span aria-hidden='true'> <CommandLineIcon size={16} /> </span> Open console </button> );}API reference
Accessibility
- The SVG has no title, desc, or role, so screen readers may ignore it or announce nothing useful. If the icon is decorative next to visible text, add aria-hidden='true' to the component or to a wrapper.
- If the icon is the only content of a control, put an accessible name on the interactive parent such as aria-label on the button, because the wrapper div does not add one.
- If the icon conveys meaning on its own, pass role='img' and aria-label through the spread props to the wrapper div.
- The looping blink is not gated by prefers-reduced-motion in this source. For users who prefer reduced motion, consider disabling the ref-driven animation or wrapping it in a media query check.
- The icon uses currentColor for its stroke, so it keeps contrast with the surrounding text color in both light and dark themes.
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 "command-line" component (heroicons-animated/command-line) from its shadcn registry.1. Install it with: npx shadcn@latest add @heroicons-animated/command-line2. 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 { CommandLineIcon } from '@/components/ui/command-line';export function Example() { return <CommandLineIcon size={28} className='text-foreground' />;}```Files & dependencies
- command-line.tsx