- Components
- Data display
- Avatar
Avatar
An image element with a fallback for representing the user.
default.tsx
Installation
CLI
Manual
npm
pnpm
yarn
bun
Usage
Use Avatar
to represent a user or an organization.
Options
Shape
Avatar
can be either a circle or a square using the shape
prop.
shape.tsx
Size
Use the size
prop to control the size of the Avatar
. The default variant is md
.
sizes.tsx
Composition
If you need to customize things further, you can drop down to the composition level.
composition.tsx
API Reference
Avatar
accepts all image attributes.
Prop | Type | Default | Description |
---|---|---|---|
src* | string | - | Specifies the path to the image |
alt | string | - | Specifies an alternate text for the image, if the image for some reason cannot be displayed |
shape | 'circle' | 'square' | 'circle' | The shape of the avatar. |
size | 'sm' | 'md' | 'lg' | 'md' | The size of the avatar. |
fallback | ReactNode | - | The fallback element to render when an image is not available. |