Avatar group
Overlap several avatars and show how many more there are.
SourceStyles source@monoline/react 0.4.0Markdown for AI toolsstable
- Built on native elements
- role="group" with an accessible name; the overflow count is plain text.
- Styles in one file:
19-avatar.css
Import
import '@monoline/css';
import {AvatarGroup} from '@monoline/react';
Not installed yet? Pick a route.
Copies the source and its styles into your project.
npx monoline add avatar-group
Usage
import {Avatar, AvatarGroup} from '@monoline/react';
<AvatarGroup aria-label="Project members" max={3}>
{['Ada Lovelace', 'Grace Hopper', 'Alan Turing', 'Linus Torvalds'].map((n) => <Avatar key={n} name={n} />)}
</AvatarGroup>
Examples
Max 3
Props
AvatarGroupProps
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label required | string | – | Names the group, for example "Project members". |
max | number | 4 | Show at most this many avatars, then "+N". |
Data Attributes
State is exposed through attributes. Style it with these selectors, not with class toggles.
This component sets no state attributes.
CSS classes
| Class | Stylesheet |
|---|---|
.avatar | 19-avatar.css |
.avatar-group | 19-avatar.css |
.avatar-lg | 19-avatar.css |
.avatar-line | 19-avatar.css |
.avatar-sm | 19-avatar.css |
.stat | 19-avatar.css |
.stat-note | 19-avatar.css |
.stat-value | 19-avatar.css |
.tag | 19-avatar.css |
Customization
Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.
app.css
.avatar {
border-color: var(--accent);
}
Accessibility
- role="group" with an accessible name; the overflow count is plain text.