Avatar is a Box with the following properties preset. You can customize it using the properties available in Box.
Custom label to be used by screen readers. When provided, an aria-label will be added to the element.
string
"a user friendly label for screen readers"
A fixed size.
string
T-shirt sizing based off the theme or a specific size in px, em, etc.
"xsmall"
"small"
"medium"
"large"
"xlarge"
"2xl"
"3xl"
"4xl"
"5xl"
"string"
At its core, the Avatar component is a regular <div> element. Thus, both DOM and React properties, methods, and events are accessible. To read up on all of the possible DOM attributes and types available for div elements, check out this MDN Web Documents page. To learn more about DOM events and methods, you can read more on the MDN Web Events documentation page.
Also, feel free to read about the types of React events available, or see how DOM attributes change in React. Working in tandem with Styled Components, you also have access to the as property.
Any additional style for the Avatar.
string
Any CSS.
css`color: 'blue'`
function
(props) => {}
Any additional style for the text.
string
Any CSS.
css`color: 'blue'`
function
(props) => {}
The size of the text that is mapped according to 'avatar.size.xsmall'.
string
"14px"
The size of the text that is mapped according to 'avatar.size.small'.
string
"18px"
The size of the text that is mapped according to 'avatar.size.medium'.
string
"22px"
The size of the text that is mapped according to 'avatar.size.large'.
string
"26px"
The size of the text that is mapped according to 'avatar.size.xlarge'.
string
"34px"