list-view
An animated list-view icon from the hugeicons-animated registry. Three stacked rounded rows squash and rebound in a staggered wave on hover, and the component can also be driven programmatically through a ref.
shadcn add · no workarounds · theme neutral (none shipped)Installation
Requires @hugeicons-animated in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { ListViewIcon } from '@/components/icons/list-view';export function Toolbar() { return ( <div className='text-zinc-700'> <ListViewIcon size={24} className='cursor-pointer' /> </div> );}- Use as a navigation or view-toggle icon that switches between list and grid layouts, where a playful hover cue is wanted.
- Use in toolbars, sidebars, or menus that need a lightweight animated icon whose color inherits from text color.
- Use when you need an imperative trigger (via ref) to play the list animation, for example after a state change.
- Avoid when a static icon is required or when the animation must loop continuously, since this item only plays once per hover or start call.
Examples
View toggle button
Hover-animated icon inside a button that switches the listing layout. Color comes from the text color via currentColor.
import { ListViewIcon } from '@/components/icons/list-view';export function ViewToggle() { return ( <button type='button' aria-label='Switch to list view' className='inline-flex items-center justify-center rounded-md p-2 text-zinc-900 hover:bg-zinc-100'> <ListViewIcon size={20} /> </button> );}Programmatic playback via ref
Use the forwarded ref to call startAnimation when the view mode changes. Hover behavior is disabled while a ref is attached, so the animation plays only when triggered from code.
'use client';import { useEffect, useRef } from 'react';import { ListViewIcon, type ListViewIconHandle } from '@/components/icons/list-view';export function ListViewIndicator({ mode }: { mode: 'list' | 'grid' }) { const iconRef = useRef<ListViewIconHandle>(null); useEffect(() => { if (mode === 'list') iconRef.current?.startAnimation(); }, [mode]); return <ListViewIcon ref={iconRef} size={24} />;}Menu item with hover handlers
Pass onMouseEnter and onMouseLeave through to observe hover events; the component calls them before running its own animation logic.
import { ListViewIcon } from '@/components/icons/list-view';export function SidebarItem() { return ( <div className='flex items-center gap-2 rounded-md px-3 py-2 hover:bg-zinc-100'> <ListViewIcon size={18} onMouseEnter={() => console.log('enter')} onMouseLeave={() => console.log('leave')} /> <span className='text-sm'>List view</span> </div> );}API reference
Accessibility
- The component renders a decorative SVG with no title or role; when it conveys meaning, wrap it in a button or link with an aria-label such as 'Switch to list view'.
- Hover animation respects the user's reduced-motion preference via useReducedMotion, which skips the animation entirely when reduced motion is requested.
- The icon uses currentColor, so it inherits text color and keeps the contrast of its surrounding text; ensure the parent color meets WCAG contrast requirements.
- Because the animation is hover-only by default, keyboard users will not see it; pair it with a focus style on the interactive parent and use the ref-driven startAnimation for focus or state changes if needed.
- The wrapper is a div with no role; if the icon is clickable, place it inside a native button for keyboard operability.
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 "list-view" component (hugeicons-animated/list-view) from its shadcn registry.1. Install it with: npx shadcn@latest add @hugeicons-animated/list-view2. 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 { ListViewIcon } from '@/components/icons/list-view';export function Toolbar() { return ( <div className='text-zinc-700'> <ListViewIcon size={24} className='cursor-pointer' /> </div> );}```Files & dependencies
- icons/list-view.tsx
- lib/use-icon-animation.ts