import ComponentBaseStyles from "../styles/ComponentBaseStyles.wrn" component AvatarGroup { outputs { overflow(payload: { sourceEvent?: Event; value: string | number | boolean | null | object; [key: string]: string | number | boolean | null | object } | string | number | boolean | null | object[]) } props { items: unknown[] = [] size: string = "md" color: string = "primary" variant: string = "solid" shape: string = "circle" layout: string = "stack" maxVisible: number = 4 columns: number = 3 borderColor: string = "" showTooltips: boolean = true overflowLabel: string = "Show remaining members" class: string = "" } state overflowOpen: boolean = false functions { shared function visibleMembers() { return items.slice(0, Number(maxVisible)) } shared function hiddenMembers() { return items.slice(Number(maxVisible)) } client function toggleOverflow() { overflowOpen = !overflowOpen output.overflow({ component: "AvatarGroup", open: overflowOpen, hiddenCount: hiddenMembers().length }) } } view {
{#each visibleMembers() as item} {#if item.src} {item.alt || item.name || ''} {:else if item.initials} {:else} {/if} {#if showTooltips && (item.tooltip || item.name)} {item.tooltip || item.name} {/if} {/each} {#if hiddenMembers().length > 0} {#each hiddenMembers() as item} {#if item.src} {:else} {item.initials || '?'} {/if} {item.name || item.alt || item.initials || 'Team member'} {/each} {/if}