View as Markdown

API reference: @salmonui/layout/avatar

AvatarPropsinterface

import type { AvatarProps } from '@salmonui/layout/avatar';
interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
    readonly src?: string | undefined;
    readonly alt?: string | undefined;
    readonly name?: string | undefined;
    readonly locale?: string | readonly string[] | undefined;
    readonly fallback?: ReactNode;
    readonly children?: ReactNode;
    readonly size?: AvatarSize | number | undefined;
    readonly shape?: AvatarShape | undefined;
    readonly tone?: AvatarTone | undefined;
    readonly variant?: AvatarVariant | undefined;
}
AvatarProps members (10)
NameSignatureDescription
srcoptionalreadonly src?: string | undefined;

Image URL; layered over the initials and hidden when it fails to load.

altoptionalreadonly alt?: string | undefined;

Accessible name of the image (wins over name).

nameoptionalreadonly name?: string | undefined;

Person or entity name: the initials and the accessible name.

localeoptionalreadonly locale?: string | readonly string[] | undefined;

Locale for upper-casing the initials (default: the runtime's default locale).

fallbackoptionalreadonly fallback?: ReactNode;

Content shown without initials (an icon), decorative.

childrenoptionalreadonly children?: ReactNode;

Overrides the initials text.

sizeoptionalreadonly size?: AvatarSize | number | undefined;

A named size (default 'md') or a size in px, e.g. 22; the initials scale with it.

shapeoptionalreadonly shape?: AvatarShape | undefined;

Default 'square' (rounded rectangle).

toneoptionalreadonly tone?: AvatarTone | undefined;

Default 'neutral'; colors come from the theme seeds.

variantoptionalreadonly variant?: AvatarVariant | undefined;

Default 'soft'; 'solid' fills with the tone color.