Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(Collapsible): let the trigger label fill the row (#5933)

Ernest899369592a76
diff --git a/.changeset/collapsible-trigger-fills-row.md b/.changeset/collapsible-trigger-fills-row.md
new file mode 100644
index 0000000000..f10189ef15
--- /dev/null
+++ b/.changeset/collapsible-trigger-fills-row.md
@@ -0,0 +1,6 @@
+---
+'@astryxdesign/core': patch
+---
+
+[fix] `Collapsible`'s trigger label now fills the row instead of hugging its own content, so a composed trigger can put something at the far edge next to the chevron. The trigger is a `space-between` flex row, but its label span had no `flex-grow` — so the free space collected between the label and the chevron, and a trigger built as `<HStack>` with a right-hand element (a date, a count, a status) had that element parked against the label with a gap after it, unable to reach the edge that `space-between` implies. `flexGrow: 1` on the label is the whole change. For a plain text trigger nothing moves: the label was already flush to the start edge and the chevron to the end, and the box that grew is one the text does not fill. The flex floor is deliberately left at `auto`, so no label can now be squeezed narrower than its own content and start overlapping the chevron. (#5933)
+@ernestt
diff --git a/apps/storybook/rtl-audit/verified-not-applicable.json b/apps/storybook/rtl-audit/verified-not-applicable.json
index 1f0f97ca30..3fb4b0453c 100644
--- a/apps/storybook/rtl-audit/verified-not-applicable.json
+++ b/apps/storybook/rtl-audit/verified-not-applicable.json
@@ -1,4 +1,8 @@
[
+ {
+ "component": "core/Collapsible",
+ "reason": "Nothing in the trigger or the panel is side-specific. The trigger is a `space-between` flex row, so the label hangs off the reading-start edge and the chevron off the reading-end edge in either direction, with no physical left or right anywhere in the styles. The chevron itself rotates between down and up — the one axis that does not mirror, because a panel opens downward in every locale — and it is a vertical glyph to begin with, so there is nothing in it to flip. The panel is a block-flow region whose only geometry is a height transition, and the group's dividers are horizontal rules. No inset, offset, order, transform, drag, scroll, or overlay."
+ },
{
"component": "core/Field",
"reason": "The Core/Field stories use block-flow labels, controls, descriptions, and status text without directional icons, side-specific placement, order, scrolling, dragging, overlays, or keyboard behavior."
diff --git a/packages/core/src/Collapsible/Collapsible.tsx b/packages/core/src/Collapsible/Collapsible.tsx
index b437b200e4..b3df63e975 100644
--- a/packages/core/src/Collapsible/Collapsible.tsx
+++ b/packages/core/src/Collapsible/Collapsible.tsx
@@ -82,6 +82,16 @@ const styles = stylex.create({
triggerLabel: {
textBoxEdge: 'cap alphabetic',
textBoxTrim: 'trim-both',
+ // Fill the row rather than hug the label. For a text trigger this changes
+ // nothing — `space-between` already had it against the start edge and the
+ // chevron against the end — but it is what lets a composed trigger put
+ // something out at the far edge, next to the chevron, rather than trailing
+ // the label with the free space stranded after it.
+ //
+ // Growing only. The flex floor stays at `auto`, so a label still cannot be
+ // squeezed narrower than its own content and nothing that used to fit
+ // starts overlapping the chevron.
+ flexGrow: 1,
},
// Disabled trigger — non-interactive, dimmed. Native `disabled` on the
// button blocks click + keyboard activation; these styles restore the