Photo and initials
A picture circled by hand, and what shows while there is none: initials on a disc of marker whose color is chosen from the name. The four sizes are `sm`, `default`, `lg` and `xl`; `AvatarBadge` puts a status dot on the corner.
A face, circled in felt tip. The picture is circled by a hand-drawn loop; without one the initials sit on a disc of marker in a stationery color chosen from the name. A status dot goes on the corner, and a group overlaps its faces and ends in a sketched "+3".
npx shadcn@latest add @wobko/avatar第一次使用?先把 registry 加进 components.json。 如何安装
A picture circled by hand, and what shows while there is none: initials on a disc of marker whose color is chosen from the name. The four sizes are `sm`, `default`, `lg` and `xl`; `AvatarBadge` puts a status dot on the corner.
Give `AvatarFallback` a `name` and it makes the initials, picks one of eight stationery colors from the name (the same person is the same color everywhere) and lets a screen reader hear the full name instead of two letters. `ring` picks the pen of the loop, and `"none"` draws no loop for long lists.
`AvatarGroup` overlaps faces and a paper-colored ring cuts each one out of the last (`--ll-avatar-ring` changes the color on a different surface). `AvatarGroupCount` is the sketched disc for everyone who did not fit; it takes text or an icon.
A people list in a card: face, name, role, and a presence dot. Each face is a separate small drawing (the list is short); a list of hundreds would use `ring="none"`.
The Radix Avatar root, a round `span`. It does not clip (the picture and the disc round themselves, always as circles: the hand-drawn loop is a circle too, so a `rounded-lg` on the root, as some sidebar templates use, does not square the face) so the loop can bleed past its box. `data-size` is read by its parts.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| size | "sm" | "default" | "lg" | "xl" | "default" | 24, 32, 40 or 56 px. Anything else: give it a `size-*` class. |
| ring | "ink" | "you" | "marker" | "none" | "ink" | The pen of the loop round the face: ink fine-liner, blue felt, a marker halo ("this one is current"), or none, which draws nothing (long lists). |
| seed | string | number | - | Pins the hand of the loop. Default: derived from useId(). |
The initials disc, shown while there is no picture.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| name | string | - | The person's name: picks the color, makes the initials when there are no children, and is read out by screen readers in place of the letters. |
| tone | "tomato" | "tangerine" | "lemon" | "grass" | "teal" | "sky" | "grape" | "bubblegum" | - | A color of your own instead of the one the name picks. |
| delayMs | number | - | Radix: wait this long before showing the fallback, to avoid a flash while the picture loads. |
A dot on the corner of the face. Its size follows the avatar's; an icon child shows from `default` up.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| status | "online" | "away" | "busy" | "offline" | "marker" | "marker" | grass, tangerine, tomato, pencil gray, or the marker of the theme. Give it text for screen readers (`<span className="sr-only">online</span>`). |
CLI 会复制进你项目的文件。
正在加载源码