Skip to content

✨ feat: add BadgeGroup component - #731

Open
futjesus wants to merge 1 commit into
mainfrom
feat/badge-group
Open

futjesus wants to merge 1 commit into
mainfrom
feat/badge-group

Conversation

@futjesus

@futjesus futjesus commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

Compute and vpc (TagOverflowList) measure tag labels with a canvas to decide how many badges fit a table column and collapse the rest into a "+N" badge; teams (PermissionBadges) does the same by count.

  • BadgeGroup (new): renders items as badges. maxVisible limits by count, maxWidth measures the labels (canvas + ResizeObserver, re-measured once fonts load) to fit the available width. Hidden items collapse into a focusable "+N" badge whose tooltip lists them (itemsPerTooltipLine, or renderOverflow for custom content); the full label list stays in an sr-only span. overflowLabel(count) localises the button name; variant / size / leftIcon pass through to Badge.
  • Exported from the package root.

Test plan

  • New tests: no limit renders all, maxVisible collapse + tooltip, sr-only full list, custom label and overflow content, empty items, unmeasurable width falls back to all, axe
  • npx vitest run lib/components/BadgeGroup, lint, types, prettier
  • Storybook: BadgeGroup (count-limited and width-limited rows)

Compute and vpc measure tag labels with a canvas to decide how many
badges fit a column and collapse the rest into a "+N" badge
(TagOverflowList); teams does the same by count for permission codes
(PermissionBadges). BadgeGroup covers both: `maxVisible` limits by count,
`maxWidth` measures the labels against the available width, and the
overflow badge is a focusable button whose tooltip lists the hidden
labels, with the complete list kept in an sr-only span.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant