Avatar
Represents a person as a square image tile that falls back to their initials.
Configurations
Supported configurations for this component.
Default
Interaction states covered by the API and the style contract.
Configurations
6 examplesDefault
1 exampleAdd to your project
One command adds this component to your project.
Run the following command. New project? Run npx shadcn@latest init first to set up Tailwind and path aliases.
npx shadcn@latest add @aicanvas/••••••••••••Light and dark both come with the install and follow the dark class on <html>, the shadcn dark mode setup (next-themes with attribute="class").
Props
Every prop this component accepts. Any other prop is forwarded to the underlying element.
| Prop | Type | Default | Description |
|---|---|---|---|
| name | string | '?' | Used to derive uppercase initials (shown when no src). |
| src | string | - | Optional image URL. When provided, renders an img instead of initials. |
| lightSrc | string | - | Optional light-theme version of `src`, for a picture made for both themes. Both load and the Andromeda theme shows one: `src` in dark, `lightSrc` in light. Needs `src`; if it fails to load, `src` shows in both themes. |
| size | 'sm'|'md'|'lg' | 'md' | One of: sm, md, lg. |
| status | 'online'|'caution'|'fault'|'offline' | - | When set, renders a status dot. |
| className | string | - | Additional CSS classes merged onto the inner avatar box (the outer wrapper receives style and ...props). |
| style | React.CSSProperties | - | Inline styles applied to the root element. |