About this set
Four round 48 pixel icon buttons that widen into pills to reveal their label on hover or keyboard focus: New project in indigo, Download in near-black, Delete in white with a grey border that turns red, and Approve in pale green. Use them in toolbars, floating action areas and table rows where space is tight but a label should still be available on demand. The label sits in a grid track whose grid-template-columns animates from 0fr to 1fr, so the button grows to exactly the width of its text without a hard-coded max-width. The collapsed text is clipped rather than hidden, so it stays in the accessible name and screen readers always announce New project, Download, Delete or Approve. The Delete button’s border was darkened from pale grey to reach 3:1 against the page, and its hover border is a stronger red. Touch screens have no reliable hover, so the label may never show there; pick icons that are clear on their own. The Bootstrap version is a .btn.rounded-pill restyled through the –bs-btn-* variables, and the Tailwind version uses group-hover and group-focus-visible with an arbitrary grid-cols value.
What’s included
- Icon buttons that expand to show their label
- Width animates to the text through a 0fr to 1fr grid track
- Label always present in the accessible name
- Primary, dark, destructive and approve colours
- Expansion is instant under reduced motion
Accessibility
Each button contains its label as real text, clipped while collapsed, so it is named without an aria-label, and the icons are aria-hidden. The label expands on :focus-visible as well as :hover, and keyboard focus draws a 2px indigo outline offset by 3px. Under prefers-reduced-motion the grid and colour transitions are removed and the label appears instantly.
Customise it
Change the fills in .xp-new, .xp-dark, .xp-danger and .xp-ok, the 48px size on .xp and .xp-ic, and the .28s timing on .xp-lbl. In Bootstrap edit --bs-btn-bg and --bs-btn-color on each class; in Tailwind edit the bg-, text-, h-12 and duration- utilities.


















