- Dependencies:
- ∟Direct: 1
- ∟Peer: 7
- Source code ↗
- Check on NPM ↗
Overview
Section titled “Overview”A fallback image element to represent a user.
import { Avatar, AvatarImage, AvatarIconFallback, AvatarTextFallback,} from '@inpulse-ui/avatar';
export function Demo() { return ( <Avatar> <AvatarImage src="https://github.com/josantana.png" /> <AvatarTextFallback>JS</AvatarTextFallback> <AvatarIconFallback /> </Avatar> );}This component is an expansion of the Avatar developed and maintained by Radix UI.
You can control the appearance of the avatar through the shape and size properties. This component also provides two types of fallbacks: one that displays the user’s initials and another that shows a default icon when the image is unavailable.
Installation
Section titled “Installation”pnpm add @inpulse-ui/avatarbun add @inpulse-ui/avataryarn add @inpulse-ui/avatarnpm install @inpulse-ui/avatarAPI Reference
Section titled “API Reference”Contains all the parts of an avatar.
| Prop | Type | Default Value | Required |
asChild | boolean | false | No |
size | enum | No | |
shape | enum | No |
The image to render. By default it will only render when it has loaded. You can use the onLoadingStatusChange handler if you need more control.
| Prop | Type | Default Value | Required |
asChild | boolean | false | No |
onLoadingStatusChange | function | - | No |
Fallbacks
Section titled “Fallbacks”An element that renders when the image hasn’t loaded. This means whilst it’s loading, or if there was an error. If you notice a flash during loading, you can provide a delayMs prop to delay its rendering so it only renders for those with slower connections. The following fallback components are available: AvatarTextFallback and AvatarIconFallback.
| Prop | Type | Default Value | Required |
asChild | boolean | false | No |
delayMs | number | - | No |
Inside the Avatar component, you can use the AvatarImage to display an image and the AvatarTextFallback or AvatarIconFallback to display a fallback element when the image is not available or still loading.
<Avatar> <AvatarImage src="https://github.com/josantana.png" /> <AvatarTextFallback>JS</AvatarTextFallback></Avatar>Examples
Section titled “Examples”Circle
Section titled “Circle”By default, all avatars are round.
import { Avatar, AvatarTextFallback, AvatarImage,} from '@inpulse-ui/avatar';
export function Demo() { return ( <Avatar> <AvatarImage src="https://github.com/josantana.png" /> <AvatarTextFallback>JS</AvatarTextFallback> </Avatar> );}Square
Section titled “Square”To get a squared avatar, you can change the shape property to square.
import { Avatar, AvatarTextFallback, AvatarImage,} from '@inpulse-ui/avatar';
export function Demo() { return ( <Avatar shape="square"> <AvatarImage src="https://github.com/josantana.png" /> <AvatarTextFallback>JS</AvatarTextFallback> </Avatar> );}Text fallback
Section titled “Text fallback”import { Avatar, AvatarTextFallback,} from '@inpulse-ui/avatar';
export function Demo() { return ( <Avatar> <AvatarTextFallback>JS</AvatarTextFallback> </Avatar> );}Icon fallback
Section titled “Icon fallback”import { Avatar, AvatarIconFallback,} from '@inpulse-ui/avatar';
export function Demo() { return ( <Avatar> <AvatarIconFallback /> </Avatar> );}If no image or fallback text is provided for whatever reason, the icon will be displayed.
Custom icon fallback
Section titled “Custom icon fallback”You can use custom icons instead of the one provided by AvatarIconFallback. To do this, simply pass the desired icon as a child of that element.
Built with by Jo Santana in Brazil.
© 2026 Inpulse. All rights reserved.