user-group

An animated user-group icon from the hugeicons-animated registry, built as a React component on Motion. On hover, the centre figure bobs up and scales slightly while the side figures slide outward and back.

user-group
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 @hugeicons-animated/user-group

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

Usage

usage.tsx
import { UserGroupIcon } from '@/components/ui/user-group';export function Example() {  return <UserGroupIcon size={24} className="text-foreground" />;}
  • Showing team, group, members, or collaborators in navigation, sidebars, or headers
  • Indicating an invite, add-members, or multi-user action in buttons or menus
  • Adding subtle hover feedback to a members or teams list entry
  • Replacing a static group icon where a lightweight micro-interaction helps users notice the item

Examples

Basic animated icon

Renders the icon at the default size of 28px. It animates on mouse enter and mouse leave.

basic-animated-icon.tsx
import { UserGroupIcon } from '@/components/ui/user-group';export default function Basic() {  return <UserGroupIcon />;}

Sidebar navigation item

Uses the icon inside a link with a custom size and colour classes that follow the theme.

sidebar-navigation-item.tsx
import Link from 'next/link';import { UserGroupIcon } from '@/components/ui/user-group';export function TeamsNavItem() {  return (    <Link href="/teams" className="flex items-center gap-2 text-sm font-medium">      <UserGroupIcon size={20} className="text-muted-foreground" />      Teams    </Link>  );}

Imperative control via ref

Attaches a ref to play the animation programmatically. When a ref is attached, hover no longer triggers the animation. Calling stopAnimation does nothing here because the component does not enable looping.

imperative-control-via-ref.tsx
import { useRef } from 'react';import { Button } from '@/components/ui/button';import { UserGroupIcon, type UserGroupIconHandle } from '@/components/ui/user-group';export function InviteButton() {  const iconRef = useRef<UserGroupIconHandle>(null);  return (    <Button      variant="outline"      onMouseEnter={() => iconRef.current?.startAnimation()}    >      <UserGroupIcon ref={iconRef} size={16} className="mr-2" />      Invite members    </Button>  );}

Hover callbacks

Passes onMouseEnter and onMouseLeave, which are called in addition to the built-in animation trigger.

hover-callbacks.tsx
import { UserGroupIcon } from '@/components/ui/user-group';export function TrackedIcon() {  return (    <UserGroupIcon      onMouseEnter={() => console.log('group icon hovered')}      onMouseLeave={() => console.log('group icon left')}    />  );}

API reference

PropTypeDefaultDescription
sizenumber28Width and height of the SVG in pixels. The viewBox stays 0 0 24 24.
classNamestring—Class names applied to the wrapping div. Use this to set colour (the strokes use currentColor) and layout.
onMouseEnterMouseEventHandler<HTMLDivElement>—Called on mouse enter before the built-in animation starts.
onMouseLeaveMouseEventHandler<HTMLDivElement>—Called on mouse leave before the built-in stop logic runs.
refRef<UserGroupIconHandle>—Forwarded ref exposing startAnimation() and stopAnimation(). Attaching it switches the component to controlled mode, so hover no longer animates automatically.
...propsHTMLAttributes<HTMLDivElement>—All other standard div attributes (id, style, aria-*, data-*, and so on) are spread onto the wrapping div.

Accessibility

  • The icon is decorative by default. When it conveys meaning on its own, wrap it in an element with an accessible name, for example aria-label on a button, or add role="img" and aria-label to the wrapping div via props.
  • The SVG has no title or aria-hidden attribute in the source. Inside a labelled button or link, add aria-hidden="true" to the icon wrapper so screen readers do not announce a duplicate name.
  • The animation respects the user's prefers-reduced-motion setting through Motion's useReducedMotion, so no movement plays when reduced motion is requested.
  • Hover-only animation gives no feedback to keyboard or touch users. Make sure the surrounding control's label and focus state communicate the same information.

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 "user-group" component (hugeicons-animated/user-group) from its shadcn registry.1. Install it with: npx shadcn@latest add @hugeicons-animated/user-group2. 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, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { UserGroupIcon } from '@/components/ui/user-group';export function Example() {  return <UserGroupIcon size={24} className="text-foreground" />;}```

Files & dependencies

  • icons/user-group.tsx
  • lib/use-icon-animation.ts
dependenciesmotion

Looks similar, elsewhere