Early bird: 30% off Dashral ProSee pricing

Dashral

Avatar

Avatar with motion: a new picture crosses over the old once it has loaded, a change of status pops the dot with one ripple, and AvatarGroup spreads apart on hover and makes room as people join or leave.

$ pnpm dlx shadcn@latest add @dashral/motion-avatar
OMOlivia MartinOMOlivia MartinOMOlivia MartinOMOlivia MartinOMOlivia Martin
LJLiam JohnsononlineBSBudi SantosoawayACAva Chen

Installation

$ pnpm dlx shadcn@latest add @dashral/motion-avatar

Adds components/dashral/motion/avatar.tsx, the Avatar it builds on (in components/dashral/), motion and the motion files every motion component shares. Or by its full URL: https://dashral.com/r/motion-avatar.json

Usage

The same as Avatar, imported from components/dashral/motion/ (with the npm package: @dashral/motion/components/avatar): swap the import and it moves.

example.tsx
import { Avatar, AvatarGroup } from "@/components/dashral/motion/avatar"

<Avatar src={user.photo} name={user.name} status={user.status} />
<AvatarGroup items={members} max={4} showNames />

Examples

Your status

Pick a status and the dot pops in its color with one ripple; On a call keeps a gentle ripple going (pulse); Change photo crosses the new one over the old.

SDSofia Davisonline

Sofia Davis

Product designer

Who's on this board

Point at the stack and it spreads; Invite and Remove fade people in and out as the rest make room, and +N changes in place.

OMOlivia MartinLJLiam JohnsonSDSofia DavisBSBudi Santoso+1

Compared with Default

Default

A picture fades in once; a new one replaces it at once. A new status changes the dot's color at once, and a group's stack stays put.

Motion

A new picture crosses over the old once it has loaded, a new status pops the dot with one ripple, and a group spreads on hover and makes room as people join or leave.

How the two editions differ in general, and which to use where: Motion.

API reference

Every prop of Avatar, and every attribute of the element it renders. What the Motion edition adds is marked Motion.

Avatar

Also takes every prop of Radix Avatar(opens in a new tab).

PropTypeDefault
pulseboolean

Motion The status dot ripples gently all the time, e.g. someone live on a call. A change of status always ripples once.

false
srcstring

The photo.

—
namestring

Who it is: the alt text, and the initials shown while the photo loads or without one.

—
altstring

The image's alt text; "" when the name is written beside it.

name
fallbackReactNode

Replaces the initials, e.g. an icon.

the initials
size"xs" | "sm" | "md" | "lg" | "xl"

24, 28, 32, 40 or 64px.

"md"
shape"circle" | "square""circle"
status"online" | "away" | "busy" | "offline"

A dot in the corner, read out too.

—
classNames{ image, fallback, status }

Classes for each part.

—
classNamestring

Extra classes, merged with cn() so yours win.

—

AvatarGroup

Also takes every prop of <div>(opens in a new tab).

PropTypeDefault
items{ src?, name?, fallback?, id? }[]

The people. Required.

—
maxnumber

Avatars shown before the rest collapse into “+N”.

—
size"xs" | "sm" | "md" | "lg" | "xl""md"
showNamesboolean

Each avatar shows its name in a tooltip, and “+N” lists the rest.

false
classNamestring

Extra classes, merged with cn() so yours win.

—

Motion

  • A picture loads before it shows, then fades in over the initials in 0.32s; a new picture loads first and crosses over the old, which stays until the new one has come in, so nothing goes blank.
  • A change of status pops the dot from half its size in its new color (0.3s, a smooth curve) and sends one ripple out from it; pulse keeps a slow ripple going every 2.4s. The first status just shows.
  • AvatarGroup spreads apart under the pointer or keyboard focus (each overlap easing from -8px to 2px), the avatar under the pointer rising 2px; avatars that join fade and grow in while the rest glide to make room, ones that leave fade out as the rest close up, and +N rises into its new count.
  • With reduced motion, pictures only fade, nothing ripples and the group doesn't spread.