A labelled group of consistently sized avatars with overflow state.
app/components/nitro_kit/avatar_stack.rbNitroKit::AvatarStack.new(size:) { |stack| stack.avatar; stack.overflow }The stack owns the size of every nested avatar and its overflow indicator.
test/dummy/app/components/gallery/components/avatar_stack_page.rbGallery::Data.avatar_stack_sizes.each do |stack|
sample(stack.label, slug: stack.slug) do
render_stack(stack)
end
endSmall, large, and explicitly labelled overflow counts remain readable and announced.
test/dummy/app/components/gallery/components/avatar_stack_page.rbsample("One more", slug: "one") do
render_overflow_stack(id: "gallery-avatar-stack-overflow-one", count: 1)
end
sample("Nine more", slug: "nine") do
render_overflow_stack(id: "gallery-avatar-stack-overflow-nine", count: 9)
end
sample("128 observers", slug: "large") do
render_overflow_stack(
id: "gallery-avatar-stack-overflow-large",
count: 128,
label: "128 additional deployment observers"
)
endImage, generated fallback, long custom fallback, and overflow compose in one labelled group.
test/dummy/app/components/gallery/components/avatar_stack_page.rbrender NitroKit::AvatarStack.new(
id: "gallery-avatar-stack-reviewers",
size: :lg,
aria: { label: "Deployment reviewers" }
) do |stack|
stack.avatar(
src: "/icon.svg",
alt: "Nitro Kit workspace",
fallback: "NK",
id: "gallery-avatar-stack-image"
)
stack.avatar(
alt: "Ada Lovelace",
id: "gallery-avatar-stack-generated"
)
stack.avatar(
alt: "Platform engineering team",
fallback: "TEAM",
id: "gallery-avatar-stack-long-fallback"
)
stack.overflow(3, label: "Three more deployment reviewers")
end