仕組み
A list of round avatars that overlap and wear a ring in the surface colour, so they read as cut-outs on any background. They pop in one after another on a spring. Hovering or focusing one lifts it 4px with a soft shadow and raises it above its neighbours, and a dark tip shows the name and an optional role. The rest collapse into a “+N” chip whose tip lists the hidden names; with onMoreClick it becomes a button. Rows wrap when there is no room, keeping the overlap.
向いている場面
- Who is on a project, a document or a call, where the faces matter more than the full list.
- Presence: who is viewing now, with online dots.
向かない場面
- When people need to read or act on every name: use a list.
使い方
import { AvatarGroup } from './AvatarGroup.jsx'
export function Members({ people, onShowAll }) {
return (
<AvatarGroup
label="Project members"
items={people.map((p) => ({ id: p.id, name: p.name, src: p.photo, status: p.role, online: p.online }))}
max={4}
size="md"
onMoreClick={onShowAll}
/>
)
}プロパティ
| プロパティ | 型 | 既定値 | 説明 |
|---|---|---|---|
items | { id?: string, name: string, src?: string, tone?: 1-8, status?: string, online?: boolean }[] | — | People in order. Without src the avatar shows initials on a soft tint; tone picks --ds-chart-N, otherwise it is derived from the name. status is the second line of the tip. |
max | number | 4 | How many faces to show before the rest collapse into “+N”. |
size | 'sm' | 'md' | 'lg' | number | 'md' | 28, 36 or 48px, or any pixel size. |
spacing | 'tight' | 'loose' | 'tight' | Overlap of 22% or 6% of the size. |
onMoreClick | () => void | — | Makes “+N” a button, for example to show everyone. |
label / moreLabel | string / (n, names) => string | 'People' | Accessible name of the list (the count is appended) and of the “+N” chip. |
アクセシビリティ
- The group is a list named with its label and count; each avatar is focusable and named with the person and status.
- The tip appears on keyboard focus as well as hover; it is decorative because the name is already the accessible name.
- “+N” announces how many are hidden and their names; with onMoreClick it is a real button.
- Reduced motion removes the pop-in and the lift; tips only fade.
モーション
Entrance: 520ms spring scale from 0.6, 45ms stagger. Lift: 320ms spring. Tip: 160ms fade and a 220ms spring rise.
プロジェクトに追加
プロンプトを Codex または Claude Code に貼り付けます。エージェントが公開ソースを読み、書き込む内容を示したうえで、既存のコンポーネントの隣に追加します。
AvatarGroup.jsxavatar-group.csstokens.cssREADME.md
2 つのファイルを一緒に導入します。スタイルは tokens.css の変数を読み、予備の値も持つため、単体でも表示できます。



