MEDIA / COMPONENT 40

Avatar

React component

Represent a person with an image or a readable initials fallback.

Try it out

Use the live controls or open the Code tab to view and copy the example.

MCARSP

API reference

Generated from the package’s TypeScript exports. Standard React event and ARIA attributes are also accepted where the component wraps a native element.

PropTypeDescription
nameRequiredstringField name used in form submission.
srcstring | undefinedStandard React / HTML attribute passed to the underlying element.
sizeSize | undefinedDefault: "medium"Size within the shared component scale.
classNamestring | undefinedAdditional CSS class names.

Accessibility & interaction

Preserve semantic structure and communicate meaning with text rather than color alone.

Visible focus, reduced motion, and both color themes are shared across staqui. Choose labels and document structure that make sense in your application; automated checks do not replace assistive-technology testing.

Variants & implementation notes

Name supplies accessible text and derived initials. Failed images fall back to initials. No remote avatar service or fabricated profile photographs.

Use the typed API above for the supported variants. The example demonstrates the primary composition; shared controls inherit hover, focus, active and disabled treatment where applicable.

Compose with