Avatar
Avatars are an essential element found in a wide range of applications, from tables to dialog menus.
Last updated
Avatars are an essential element found in a wide range of applications, from tables to dialog menus.
Last updated
The Avatar component is used to represent users, providing a visual representation such as text initials, profile images, or icons. It comes with 60 variants and different customization options to fit various design requirements.
The anatomy of avatar component comprises key elements, including the avatar image, container, and optional customization properties. These elements enhance user interaction and engagement in your application.
With our properties and component structure, you have the creative freedom to tailor your avatar to precisely match your design preferences. All variable and variants identified exactly same on both our design system and our multi-framework component library.
The Avatar component supports different types to represent users in various ways.
Text type avatar displays initials representing the user's name.
Image type avatar displays a user's profile image.
Icon type avatar displays a custom icon to represent the user.
When no avatar image is available, the system uses the initials of the user's first and last name, capitalizing them. In the absence of user information, it substitutes with an icon.
A text avatar acquires the capitalized initials of both the user's first name and last name. However, for XS-sized avatars, it uses only the capitalized initial of the user's first name.
When both the first name and last name consist of more than two words, the text avatar will solely utilize the capital initials of the first and last names.
The Avatar component supports different size variants such as extra small, small, medium and large to fit various design requirements.
You can also customize the size of the avatar component.
The invert property provides the option to invert the color scheme of the avatar. This can be particularly useful for highlighting specific avatars or indicating a change in status or mode. By inverting the colors, you can draw attention to certain avatars and create a visually distinct user experience.
The shape property allows you to define the shape of the avatar. Avatars can take on one of two shapes: "circle" or "square." You can choose the shape that best aligns with your design preferences or the specific context in which the avatar is used.
Circle shape imparts a rounded, circular appearance to the avatar. It's often employed to create a softer and more approachable visual identity for users or entities.
Square shape imparts a square or rectangular appearance to the avatar. This shape provides a more geometric and structured visual style, suitable for various design contexts.
Layout and spacing for avatar in user interfaces are crucial for usability, aesthetics, and accessibility. By paying attention to the placement and spacing of avatar, designers can create interfaces that are both visually appealing and user-friendly, ultimately enhancing the overall user experience.
Providing both light and dark modes for avatar in user interfaces enhances user comfort, choice, accessibility, and energy efficiency. It also aligns with contemporary design trends and accommodates a variety of user preferences and needs.
Accessibility is not only a moral and legal imperative but also a valuable design principle. Ensuring that avatar in a design system are accessible not only benefits users with disabilities but also leads to a more inclusive, user-friendly, and successful digital product.
To learn more about Plus UI's accessibility criteria, please visit Accessibility.
Kind | Size | Invert | Shape |
---|---|---|---|
Criteria | Description | Status |
---|---|---|
Property | Description | Type | Accepted Values | Default |
---|---|---|---|---|
Text
xs
True
Circle
Image
xm
False
Square
Icon
md
lg
custom
ARIA attributes
Ensures ARIA attributes are allowed for an element's role
ARIA Role
Ensures role attribute has an appropriate value for the element
Aria-hidden Elements
Ensures aria-hidden elements are not focusable nor contain focusable elements
Attributes Provided
Ensures elements with ARIA roles have all required ARIA attributes
Roles Valid Values
Ensures all elements with a role attribute use a valid value
Attributes Valid Values
Ensures all ARIA attributes have valid values
Attributes Valid Names
Ensures attributes that begin with aria- are valid ARIA attributes
Unique ID Attributes
Ensures every id attribute value is unique
Nested Interactive Controls
Ensures interactive controls are not nested as they are not always announced by screen readers or can cause focus problems for assistive technologies
Alternative Text
Ensures [role='img'] elements have alternate text
Color Contrast
Ensures the contrast between foreground and background colors meets WCAG 2 AA contrast ratio thresholds.
text
Avatar text
String
—
—
image
Avatar image
String
—
—
icon
Avatar icon
String
—
—
shape
Avatar shape
String
circle, square
circle
size
Avatar size
String, Number
xs, sm, md, lg, xl, number
md
invert
Invert avatar
Boolean
—
false