Skip to content
Klarhimmel UI

Avatar group

MSOLINJE
npx shadcn add @klarhimmel/avatar-group

Examples

  • Basic

  • Sizes

  • Overflow

DetailsAbout, usage, props and more

People who share something, overlapped, with the rest collapsed into a named +N chip.

When to use

  • Use for

    Members of a team, watchers of a booking, guests in a party.

  • Not for

    One person. Use Avatar. A list people act on. Use a list or Table.

  • Pairs with

    Avatar, Tooltip, Badge.

Preview

MSOLINJE

Six people on the events team.

avatar-group.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { AvatarGroup } from '@/components/klarhimmel/ui/avatar-group';

export default function Example() {
  return (
    <Theme theme="brand">
      <AvatarGroup people={[{ name: 'Maja Sund' }, { name: 'Oskar Lind' }, { name: 'Ida Nord' }]} max={2} />
    </Theme>
  );
}

Import

Import

import { AvatarGroup } from '@/components/klarhimmel/ui/avatar-group';
Files
avatar-group.tsx, in components/klarhimmel/ui/. With it: avatar, theme, utils.
Render in
Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.

Props

PropTypeDefaultDescription
people{ name: string; src?: string }[]requiredRequired. Names become the accessible names and the initials.
maxnumber4How many show before the "+N" chip. Default 4.
sizeExclude<AvatarProps['size'], 'lg'>'sm'Avatar size.
aria-labelstring-Names the group when the default (the names, then "and N more") is not what you want.
moreLabel(n: number) => string(n) => `${n} more`The chip's name: default "3 more". Pass it translated.
classNamestring-Extra classes, merged after the component's own.

Accessibility

KeyDoes
TabNot interactive: nothing to focus

The group is named after who is in it, and the +N chip is named "N more", so the overflow is heard as well as seen.

Accessibility