Skip to content

feat(Collapsible): let the chevron lead the trigger - #5993

Open
ernestt wants to merge 2 commits into
mainfrom
core-collapsible-chevron-placement
Open

feat(Collapsible): let the chevron lead the trigger#5993
ernestt wants to merge 2 commits into
mainfrom
core-collapsible-chevron-placement

Conversation

@ernestt

@ernestt ernestt commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What

Collapsible and CollapsibleGroup take a chevronPlacement prop. The default, 'end', is exactly what ships today; 'start' moves the disclosure arrow ahead of the label.

The leading arrow is the tree and file-browser convention — the one you want when a column of labels should line up behind the arrows. Until now only TreeList and the Table row-expansion column could draw one, so a card or accordion header had no way to match them.

leading chevron, light

leading chevron, dark

Why the glyph changes with the side

A trailing chevron points down and flips up. A leading one points into the row and turns down. Rotating chevronDown a quarter turn would leave the closed state pointing the wrong way, so 'start' swaps in chevronRight and rotates 0° → 90°, mirrored in RTL. That is what TreeList already does, so the two now agree.

Why the group carries it

A list whose arrows change sides row to row reads as a bug, so CollapsibleGroup passes the placement down through the same presentation context that already carries hasDividers and density. An individual item still overrides its group, and a collapsible nested inside an item's body keeps its own default rather than inheriting.

One layout consequence

A leading arrow also makes the trigger label fill the row. The trigger is space-between: with a trailing arrow that rule is what separates the two, but with the arrow leading there is no third child to absorb the free space, so an unfilled label would be thrown to the opposite edge with a gap behind the arrow. Filling it also gives a trigger that spreads its own contents (hAlign="between" and the like) the whole row to spread across — which is what the screenshots above rely on.

This overlaps with #5933, which makes the label fill unconditionally. The two are independent and either order merges; if #5933 lands first, the conditional style here becomes redundant and the rebase drops it.

Test plan

  • 43 Collapsible tests pass, 7 of them new: DOM order for each side, that the glyph changes with the side rather than only the position, group inheritance, item-over-group override, no leak into a nested collapsible, and that the label fills the row when the arrow leads.
  • tsc --noEmit and eslint clean on packages/core/src/Collapsible.
  • Screenshots above are the table-grouped template with chevronPlacement="start" applied locally, light and dark.

Collapsible has always drawn its chevron as a trailing indicator. The
leading disclosure arrow — the tree and file-browser convention, where the
labels form a column the arrows sit in front of — was only available from
TreeList and the Table row-expansion column, so a card or accordion header
had no way to match them.

`chevronPlacement` adds that side. The default is unchanged.

The side picks the glyph as well as the order. A trailing chevron points
down and flips up; a leading one points into the row and turns down, so
`start` swaps chevronDown for chevronRight and rotates a quarter turn
rather than a half, mirrored in RTL the way TreeList already does it.

CollapsibleGroup carries it through the presentation context that already
holds hasDividers and density, because a list whose arrows change sides
row to row reads as a bug. An item still overrides its group, and a
collapsible nested in an item's body keeps its own default.

A leading arrow also makes the label fill the row: the trigger is
space-between, so with nothing after the label to absorb the free space it
would otherwise be thrown to the far edge, leaving a gap behind the arrow.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 3, 2026 11:18pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 3, 2026
@github-actions github-actions Bot added the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Sep 3, 2026
github-actions Bot added a commit that referenced this pull request Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded failure. Current analysis and preview links are unavailable.


Generated by PR Enrichment workflow | View current CI run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:code-review High-risk change (new package/component/API) — needs human code review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant