Aliases
user avatar
components / avatar
Image or initial fallback surface with size, shape, and ring visibility recipes.
Playground
Start here. Switch systems, interact with the shipped component, and let the rest of the page answer the why and how after the behavior clicks.
Cobalt
The crisp default DK action system: bright primary, roomy spacing, and a direct editorial rhythm.
Overview
This section explains the intent of the component before the implementation details.
Aliases
user avatar
Explore the math
Decision guide
Use these notes to decide quickly whether this is the right DK component for the job.
Decision guide
Do
Do not
Usage
Prefer these situations when choosing this component.
Usage
These patterns are better served by a different component or a simpler surface.
Anti-patterns
Migration notes
Anatomy
The anatomy explains which pieces matter to the recipe and accessibility model.
avatar shell
rootCarries shape, size, and ring treatment.
optional visual asset
imageShows the supplied image when available.
initials fallback
fallbackShows derived initials when no image exists.
API
The docs contract distinguishes props, DOM events, and slots so integration behavior is explicit.
Props
| Name | Type | Default | Description |
|---|---|---|---|
name | string | — | Source for initials fallback and labeling. |
src | string | — | Optional image source. |
alt | string | — | Optional alt text for meaningful imagery. |
size | 'sm' | 'md' | 'lg' | 'md' | Chooses the compiled size recipe for the component. |
shape | 'circle' | 'rounded' | 'circle' | Chooses the avatar silhouette. |
theme | ThemeContract | — | Overrides the compiled DK theme used to resolve tokens and recipes for this component. |
Slots
| Name | Description |
|---|---|
default | Avatar is prop-driven in v1 and does not expose content slots. |
Recipes
These notes summarize the intended recipe surface rather than exposing raw implementation detail first.
Variants
Sizes
States
Accessibility
This is the behavior the component promises to assistive tech and keyboard users today.
Semantics
Keyboard
Screen readers
Checklist
Implementation
This section shows the representative compiled slot variables that the runtime consumes for the selected design system.
Implementation notes
Implementation checklist
Examples
Each example is intentionally practical, grouped by starter, common pattern, and edge-case coverage.
Starter
1 example
starter
Starter: initials fallbackA default fallback avatar using initials derived from the name.
Copy snippet
<Avatar name="Design Kit" size="md" />Common patterns
1 example
common
Common: image-backed identityProvide `src` and useful alt text when the image itself matters.
Copy snippet
<Avatar name="Anika Rose" src="/images/anika.jpg" alt="Anika Rose" size="sm" />Edge cases
1 example
edge
Edge: rounded entity markerRounded shape works well for teams or non-person entities.
Copy snippet
<Avatar name="Relaunch Team" shape="rounded" size="lg" />Verification
Proofs stay visible in the docs so the system shows what it can guarantee, not just what it can render.
shape=circle|size=sm
shape=circle|size=md
shape=rounded|size=lg