Avatar

Get started with the basics of using the Avatar component.

experimental
---
import Avatar from '@/components/Avatar.astro';
---

<Avatar />

Variants

Rocketship Avatar components come with different variants. You can customize the components by changing the variant.

variantdescriptionexamplecode
solidSolid Avatar <Avatar variant="solid" />
softSoft Avatar <Avatar variant="soft" />
outlineOutline Avatar <Avatar variant="outline" />

Sizes

Rocketship components use a numeric scale for sizes. You can customize the Avatar by changing the size.

sizedescriptionexamplecode
1Tiny Avatar <Avatar size="1" />
3Small Avatar <Avatar size="3" />
5Medium Avatar <Avatar size="5" />
7Large Avatar <Avatar size="7" />

Note: Sizes 2, 4, 6, and 8 are also available for more fine-grained control.

Colors

Rocketship Avatar components come with different colors based on the Radix color system. You can customize the components by changing the color.

colordescriptionexamplecode
indigoIndigo Color <Avatar color="indigo" />
blueBlue Color <Avatar color="blue" />
greenGreen <Avatar color="green" />
redRed <Avatar color="red" />
orangeOrange Color <Avatar color="orange" />
purplePurple Color <Avatar color="purple" />
grayNeutral Color <Avatar color="gray" />

Image Source

You can provide an image source for the Avatar:

User Avatar
<Avatar src="path to image" alt="User Avatar" size="5" />

Initials

If no image is provided, you can display initials:

AA
<Avatar initials="AA" color="blue" size="5" />

Combining Properties

You can combine different properties to create custom avatars:

<Avatar size="6" color="cyan" variant="outline" initials="AA" />

This will create a medium-large, cyan-colored outline avatar with the initials “AA”.

AA