Avatar
Usage
BF
K
MI
X
Properties
Initial limit
Size
Round
Color
Avatar.Group
4N
BF
OL
Y
+999
Initial limit
Round
Size
Gap
Color
API References
Styles API
type T = "root" | "group" | "image" | "fallback";
Styles API | Type | Default | Annotation |
---|---|---|---|
unstyled? | Partial<Record<T, boolean>> | false | if true , all default styles will be removed |
classNames? | Partial<Record<T, string>> | undefined | Set className for T |
styles? | Partial<Record<T, CSSProperties>> | undefined | Set style for T |
Props API
Styles API | Type | Default | Annotation |
---|---|---|---|
size? | number | ${number} | 38 | Width and height of the avatar, numbers are converted to rem |
round? | (string & {}) | number | 9999 | Key of CSS value to set border-radius. |
color? | CSSProperties["color"] | "initials" | gray | Key of CSS color. |
src? | ImageProps["src"] | null | undefined | Image url, if the image cannot be loaded or src={null} , then fallback is displayed instead |
alt? | string | undefined | Image alt attribute, also used as title attribute for fallback |
imageProps? | ImgProps | undefined | <NextImage/> tag attributes |
children? | React.ReactNode | null | Avatar placeholder, displayed when src={null} or when the image cannot be loaded. |
fallback? | React.ReactNode | null | A fallback tree to show when a Avatar src suspends. |
name? | string | initials | Name of the user. When src is not set, used to display initials and to generate color. |
allowedInitialsColors? | CSSProperties["color"][] | undefined | An array of colors that can be used for autogenerated initials |