# @salmonui/layout/avatar API reference

> 9 exported symbols of @salmonui/layout/avatar: 3 functions, 2 interfaces and 4 types.

Canonical: https://salmonui.dev/docs/reference/layout/avatar

```ts
import { … } from '@salmonui/layout/avatar';
```

## Functions

### Avatar

Kind: function

Page: https://salmonui.dev/docs/reference/layout/avatar/Avatar

```ts
function Avatar(props: AvatarProps): ReactElement;

namespace Avatar {
    export { AvatarGroup as Group };
}
```

Avatar (`.salmon-avatar`, `data-size`, `data-shape`, `data-tone`, `data-variant`). With
`alt` or `name` it is an image (`role="img"`, `aria-label`); otherwise it
is decorative (`aria-hidden`), for use inside a labelled control.

### AvatarGroup

Kind: function

Page: https://salmonui.dev/docs/reference/layout/avatar/AvatarGroup

```ts
function AvatarGroup(props: AvatarGroupProps): ReactElement;
```

Overlapping avatars (`.salmon-avatar-group`, `role="group"`) with a `+N` overflow avatar.

### initialsOf

Kind: function

Page: https://salmonui.dev/docs/reference/layout/avatar/initialsOf

```ts
function initialsOf(name: string, locale?: string | readonly string[]): string;
```

Initials of a name: the first letter of the first and of the last word
(one letter for a single word), upper-cased for `locale`.

## Interfaces

### AvatarGroupProps

Kind: interface

Page: https://salmonui.dev/docs/reference/layout/avatar/AvatarGroupProps

```ts
interface AvatarGroupProps extends HTMLAttributes<HTMLDivElement> {
    readonly children?: ReactNode;
    readonly max?: number | undefined;
    readonly size?: AvatarSize | number | undefined;
    readonly shape?: AvatarShape | undefined;
    readonly localeText?: {
        readonly more?: ((count: number) => string) | undefined;
    } | undefined;
}
```

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `children` | `readonly children?: ReactNode;` | optional | `Avatar` children, stacked with an overlap. |
| `max` | `readonly max?: number \| undefined;` | optional | Show at most this many avatars; the rest become one `+N` avatar. |
| `size` | `readonly size?: AvatarSize \| number \| undefined;` | optional | Size (named or px) and shape of the `+N` avatar. Defaults `'md'` / `'circle'`. |
| `shape` | `readonly shape?: AvatarShape \| undefined;` | optional |  |
| `localeText` | `readonly localeText?: {     readonly more?: ((count: number) => string) \| undefined; } \| undefined;` | optional |  |

### AvatarProps

Kind: interface

Page: https://salmonui.dev/docs/reference/layout/avatar/AvatarProps

```ts
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;
}
```

Members (10):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `src` | `readonly src?: string \| undefined;` | optional | Image URL; layered over the initials and hidden when it fails to load. |
| `alt` | `readonly alt?: string \| undefined;` | optional | Accessible name of the image (wins over `name`). |
| `name` | `readonly name?: string \| undefined;` | optional | Person or entity name: the initials and the accessible name. |
| `locale` | `readonly locale?: string \| readonly string[] \| undefined;` | optional | Locale for upper-casing the initials (default: the runtime's default locale). |
| `fallback` | `readonly fallback?: ReactNode;` | optional | Content shown without initials (an icon), decorative. |
| `children` | `readonly children?: ReactNode;` | optional | Overrides the initials text. |
| `size` | `readonly size?: AvatarSize \| number \| undefined;` | optional | A named size (default `'md'`) or a size in px, e.g. `22`; the initials scale with it. |
| `shape` | `readonly shape?: AvatarShape \| undefined;` | optional | Default `'square'` (rounded rectangle). |
| `tone` | `readonly tone?: AvatarTone \| undefined;` | optional | Default `'neutral'`; colors come from the theme seeds. |
| `variant` | `readonly variant?: AvatarVariant \| undefined;` | optional | Default `'soft'`; `'solid'` fills with the tone color. |

## Types

### AvatarShape

Kind: type

Page: https://salmonui.dev/docs/reference/layout/avatar/AvatarShape

```ts
type AvatarShape = 'square' | 'circle';
```

### AvatarSize

Kind: type

Page: https://salmonui.dev/docs/reference/layout/avatar/AvatarSize

```ts
type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
```

### AvatarTone

Kind: type

Page: https://salmonui.dev/docs/reference/layout/avatar/AvatarTone

```ts
type AvatarTone = 'neutral' | 'primary' | 'info' | 'success' | 'warning' | 'danger';
```

### AvatarVariant

Kind: type

Page: https://salmonui.dev/docs/reference/layout/avatar/AvatarVariant

```ts
type AvatarVariant = 'soft' | 'solid';
```

`'soft'` (default): a tinted fill with tone text. `'solid'`: the tone fill with on-color text (neutral: gray with white).
