Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
Composition
AvatarGroup (optional) ├── Avatar │ ├── AvatarImage (optional) │ ├── AvatarFallback │ └── AvatarBadge (optional) └── AvatarGroupCount (optional)
Examples
Badge
Loading...
Default
Loading...
Dropdown Menu
Loading...
Group Count
Loading...
Group
Loading...
Profile
Loading...
Sizes
Loading...
Variants
Loading...
With Tooltip
Loading...
API Reference
Avatar
| Prop | Type | Default | Description |
|---|---|---|---|
size | "default" | "sm" | "lg" | "xs" | "xl" | "default" | Sets the avatar size. |
shape | "round" | "square" | "round" | Sets the avatar shape. |
id | string | undefined | generated | Unique identifier used to connect the avatar parts. |
ids | ElementIds | undefined | — | Overrides generated identifiers for individual parts. |
onStatusChange | ((details: StatusChangeDetails) => void) | undefined | — | Runs when the image loading status changes to loaded or error. |
Context, Hooks, and Types
| Export | API |
|---|---|
AvatarContext | Render-prop component that exposes component state and actions. |
AvatarRootProvider | Provides an externally created API to the component tree. |
useAvatar | Creates or accesses the component API. |
useAvatarContext | Returns the nearest component API. |
Angular
React
Solid
Svelte
Vue