Axon 911 Frontend DocsAxon 911 Frontend Docs
Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Components
  2. Avatar
  3. API and Development

Avatar

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
Avatar represents people and entities across the product. It supports images and text fallback. Pass exactly one of alt (accessible description) or decorative (skips the avatar for screen readers, e.g. when an adjacent name already announces it) — passing both, or neither, is a type error.
Props
NameTypeDefaultDescription
altAvatarName—Accessible name, such as the person's name. The first character is the default initials. Not allowed on a decorative avatar.
colorAvatarColor—Fill and initials color. Defaults to {@link AvatarColor.Default}.
decorativeboolean—When omitted or false, the avatar is meaningful and must supply alt. Hides the avatar from assistive technology.
fallbackAvatarName—Text shown when there is no image. Defaults to the first character of alt.
idstring—Element id of the root.
refRef<HTMLSpanElement>—Ref to the root span.
shapeAvatarShape—Outline. Defaults to {@link AvatarShape.Circle}.
sizeAvatarSize—Diameter and initials type role. Defaults to {@link AvatarSize.Regular}.
srcstring—Trusted image URL, rendered with Image. Without it, or when it fails to load, the initials show.
Storybook
Interactive examples and edge cases for this component are in Storybook.
DefaultOpens in a new tab
Sizes
Avatar supports three sizes for different layout needs—Small, Regular, and Large.
Small
Use Small in compact layouts, such as lists or dense UIs.
Regular
Default is suitable for most contexts.
Large
Use Large when the avatar is a focal point, such as profile views.
Colors
Color variants help convey emphasis or state.
Default
Default is standard color for most use cases.
Accent
Use Accent for active, live, or otherwise emphasized avatars.
Shapes
Choose a shape that matches the context.
Circular
The default shape, Cicle, is appropriate for people avatars.
Square
Use Square for organizations or when a more structured look is desired.
Content types
Avatar adapts based on the data provided.
Image
Image displays a profile image when src is provided.
Text fallback
The fallback feature automatically shows the first character of alt when no image is available.
Custom fallback
Provide explicit fallback content for greater control.
Decorative
Use decorative when the name already appears as visible text next to the avatar, so it isn't announced twice.
Previous
Avatar / Usage
Next
Avatar / Accessibility
On this page
Props
Storybook
Sizes
Small
Regular
Large
Colors
Default
Accent
Shapes
Circular
Square
Content types
Image
Text fallback
Custom fallback
Decorative