Examples
Basic
Prop | Default | Type | Description |
---|---|---|---|
src | - | string | The image source. |
alt | - | string | The alternative text. |
label | - | string | The placeholder of the avatar when it is loading. By default, it uses the first letters of each word in the alt prop. |
Read more in Radix Avatar Root API.
PRPR
Variant
Prop | Default | Type | Description |
---|---|---|---|
avatar | soft | {variant} | The variant of the avatar. |
Variant | Description |
---|---|
soft | The default variant. |
solid | The solid variant. |
outline | The outline variant. |
~ | The unstyle or base variant |
PRPRPRPR
Color
Prop | Default | Type | Description |
---|---|---|---|
avatar | {variant}-gray | {variant}-{color} | The color of the avatar. |
Dynamic colors:
PRPRPRPRPRPR
Static colors:PRPR
Icon
Prop | Default | Type | Description |
---|---|---|---|
icon | false | boolean | If true, the label will be wrapped as an Icon component. The label can be passed as the name of the icon. |
Size and Square
Prop | Default | Type | Description |
---|---|---|---|
size | md | string | Sets the size of the avatar. |
square | 2.5rem | string | Sets the avatar to a square shape with specified dimensions. This does not affect the size of the fallback value. |
🚀 Adjust input size freely using any size, breakpoints (e.g.,
sm:sm, xs:lg
), or states (e.g.,hover:lg, focus:3xl
).
The padding, icons, and text-size of the input scale are dynamically adjusted based on the size property. To customize the text-size and padding simultaneously, you can use utility classes.
Rounded
Prop | Default | Type | Description |
---|---|---|---|
rounded | full | string | Set the avatar to have rounded corners. |
With Indicator
PR
PR
11
PRNewNew
Read more in Indicator component
Customization
You can customize the avatar using the
una
prop and utility classes.
PRPR
Slots
Slot | Props | Description |
---|---|---|
default | - | The image element of the avatar. |
fallback | - | The fallback element of the avatar. |
PR
Read more in Button component slots
Presets
shortcuts/avatar.ts
Props
types/avatar.ts