Skip to content
v0.2.10

Avatar

A stable identity image with initials or an explicit text fallback.

Preview

Use Avatar

Avatar is a named export of @flood-md/react. Connect the package once, then import what you use.

First time here? Connect Flood
Example import style
avatar.tsxTSX
"use client";

import { FloodRoot, Avatar } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <Avatar name="Alex Morgan" />
    </FloodRoot>
  );
}

Design notes

  • Name supplies the accessible image name; decorative suppresses duplicate naming next to an equivalent visible name.
  • Fallback remains visible until the image loads and after a load error. Changing src starts a fresh load lifecycle.
  • Native span props and ref target the root. Size and shape do not change during loading. Available in 0.2.4.

API reference

PropValuesDefault
namestringRequired
srcstring—
fallbackstring—
size"sm" | "md" | "lg""md"
shape"circle" | "rounded""circle"
decorativebooleanfalse
Native HTML propsOmit<HTMLAttributes<HTMLSpanElement>, "children" | "role" | "aria-label" | "aria-hidden">Forwarded
View TypeScript source