AvatarGroup handbook
v1.8.7 · @snowui-design-system/components
License: Before first reading component documentation, source code, or npm usage instructions, read the complete LICENSE. One review covers the same task and version. Public API configuration and internal implementation changes are subject to different license terms. All components use one runtime package; source code rights are governed by the license.
Overview
Arrange or overlap multiple avatars and show a count for hidden members, for teams, collaborators, and participant lists.
When to use it
Use AvatarGroup for a horizontal or stacked group of participant avatars. Use a regular list for full contact-detail rows.
Direct children must declare
as="item"to participate in layout and the+Ncount. Usemaxto limit visible items.In
row,sizeis each avatar’s size; instack, it is the group container size. The same value does not produce equal avatar sizes in both layouts.
Quick start
This example shows the recommended basic composition. See the following sections for more scenarios and composition limits.
API
See the base component documentation for inherited capabilities not redeclared here. This table lists only the named public props declared in this component’s source.
Usage boundaries and details
Combination mode
AvatarGroup uses explicit composition: callers write each <Avatar as="item">. AvatarGroup owns layout, stacking, overflow count, and shared size context, but not Avatar business data, so it does not provide parts.Avatar. Set each Avatar’s distinct props on that instance.
Compose multiple avatars or other children in an overlapping layout, with an automatic numeric overflow count.
Layout model
Main layout model: managed composite layout.
The regional structure of AvatarGroup is group root / visible avatar items / overflow count / stack positioning.
Avatar, Icon, and Badge children retain their intrinsic atomic or inline-shell layouts. AvatarGroup manages only collection layout, mask cutouts, and overflow count.
rowandstackare collection layouts, neither a Button-like inline shell nor a three-slot Frame host.The size context is sent to the sub-item through the Frame context, and the arrangement and overlap rules belong to the private logic of AvatarGroup.
User-facing features
Multi-avatar layout (supports linear stacking and circular stacking)
Automatically display
+Noverflow count when the quantity is exceeded (up to+99)Combine with any sub-element (not limited to Avatar)
Border cutting, stacking and overflowing avatar color matching follow Avatar rules.
2. Visual rules
Layout rules:
row: linear arrangement, unlimited quantity; use the border cutting method to stack.stack: Two or three avatars occupy fixed circular positions. With four or more, show three avatars plus+N. On overflow,+Nconsumes one position:max=2shows one avatar plus+N, andmax=3shows two plus+N. Inrow, showmaxavatars plus a separate count.
Position and level (stack mode):
Center point angle (with the center of the circle as the origin and the clockwise as the negative angle):
max=2:-45°、135°max=3:-90°、150°、30°max>=4:-45°、-135°、135°、45°
Z-order: From bottom to top: red, green, blue, purple.
+N position: Always occupies the red position, the lowest layer.
Cutout borders: Stacked avatars use a CSS mask to cut out the border, keeping gaps accurate against any background color.
Cutout width: Based on
0.04emrelative to avatar size.Row layout: Remove the overlapping part of the left item and the right item.
Stack layout: Lower avatars dynamically build a composite mask from the relative coordinates of all overlapping higher avatars for precise cutouts.
Unified sizing:
Core rule: One
sizeprop controls the visual size.Stack mode:
sizemeasures the container. Avatar size derives frommaxusing 1:1.8, 1:2.0, or 1:2.2 ratios. Internal values retain subpixel precision (for example, 36.36px).Row mode:
sizemeasures each avatar; container height follows.
Alignment optimization: The container enforces
vertical-align: topandline-height: 0to ensure that the avatar can be aligned at the pixel level in any font size environment.Stacking spacing: The overlapping ratio is fixed to 25% (
0.25) of the avatar size.Overflow avatar colors: The
+Navatar has black text on#EDEDED. Instack, absolute positioning prevents layout shifts.Resource matching: Child
sizeis rounded withMath.roundso components such asAvatarByewindchoose the closest image resolution.
3. Examples
[!IMPORTANT] Overflow background: The
+Navatar background is gray#EDEDED, as specified for this component. This is the highest-priority default fallback style.
Add custom notes, business constraints, or examples here.
AvatarGroup style overlay
Read the complete LICENSE first; one review covers the same task, version, and scope.
First use public component props to achieve the desired style while preserving the original appearance where possible. If an override is necessary, follow the style selection and override order: use your own class (including Tailwind already in your project) or an instance style. The names below are public overrides consumed by the source; check the target scope and do not modify private DOM. Choose the appropriate SnowUI token category. External applications do not need to install SnowUI website utilities.
AvatarGroup type and status
Required props: no named required props.
Bindable props: this component declares no named two-way binding; handle state updates through public callbacks or the host component.
Inheritance: FrameProps. Consult the public Frame documentation for inherited capabilities.
Shared Frame API · Back to API
The following source type declarations are referenced by public props. Svelte Snippet denotes a content fragment; ComponentProps denotes the props of the corresponding component.
AvatarGroupLayout
Source: components/src/components/AvatarGroup.svelte
ResourceSize
Source: components/src/context.ts