Avatar
Circular avatar with image or fallback initials. The pastel ring glows only while the pointer is over that avatar, so a stack never lights up all at once, and its colour shifts with pointer position via pastelColour. All glow via refs and rAF.
- requestAnimationFrame
- Proximity Detection
- pastelColour
avatar
Move your cursor near the avatars.
Usage
Drop it in
import { Avatar } from "@/app/lib/components/avatar";<Avatar src="https://i.pravatar.cc/80" alt="User" />
<Avatar fallback="SK" size={56} />API
Props
| Prop | Type | Default |
|---|---|---|
srcImage URL | string | — |
altAlt text for the image | string | "" |
fallbackFallback initials when no src is provided | string | "" |
sizeDiameter in pixels. Default: 40 | number | 40 |
classNameAdditional class names | string | "" |
Read from the component's source at build time. * required.
Accessibility
Works with
- Cursor
- Reacts to where the pointer is, not just whether it's over the element.
- Touch
- Follows your finger while it's down, then settles a moment after you lift.
- Keyboard
- Focus lights it up the way the cursor does. Every action has a key.
- Reduced motion
- Nothing moves or springs. Colour still answers, without drifting.