Skip to content

feat(segmented-control): animated selection indicator like Tabs - #906

Merged
uixmat merged 3 commits into
mainfrom
acting-as-a-main
Oct 20, 2026
Merged

uixmat merged 3 commits into
mainfrom
acting-as-a-main

Conversation

@uixmat

@uixmat uixmat commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Segmented controls now slide a pill between items, matching TabsList.

  • New @coss/segmented-control-indicator: a SegmentedControlIndicator client component rendered as the last child of the segmented root. It tracks the direct child with data-checked, aria-current="page", or data-pressed and animates over 200 ms ease-in-out (none with reduced motion). It's hidden when nothing is active.
  • segmented-control lib: state variants now only set the active text colour; the pill surface is a shared segmentedControlIndicatorSurfaceClassName, also used by the Tabs indicator.
  • Particles: radio group (7–9) and navigation (1–3) render the indicator; navigation particles now track the clicked link so the demo animates.
  • Docs: segmented control page and coss skill reference updated.

Breaking for custom compositions: the item recipe no longer paints the active background, so they must render <SegmentedControlIndicator />.

Demo

Area.mp4

Testing

  • registry:validate-deps, registry:build, ui:sync, and tsc pass.
  • Browser-checked in light/dark at 1280px and 390px: pill aligns exactly with the active item, slides on click and arrow keys, matches the Tabs pill, and Tabs are unchanged; no console errors.

🤖 Generated with Claude Code

Add SegmentedControlIndicator (@coss/segmented-control-indicator), which
tracks the checked, current, or pressed item and slides a shared pill to it.
Item state recipes now only set the active text color, and Tabs share the
pill surface class. Radio group and navigation particles render the
indicator, and navigation particles track the clicked link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
coss-com Ready Ready Preview Oct 20, 2026 2:38pm UTC
coss-com-ui Ready Ready Preview Oct 20, 2026 2:38pm UTC
coss-examples-calcom Ready Ready Preview Oct 20, 2026 2:38pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
coss-com-origin Skipped Skipped Oct 20, 2026 2:38pm UTC

Request Review

@vercel

vercel Bot commented Oct 20, 2026

Copy link
Copy Markdown

Deployment failed for project coss-examples-calcom with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: coss-examples-calcom.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

…ticles

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 20, 2026

Copy link
Copy Markdown

Deployment failed for project coss-com-ui with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: coss-com-ui.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@vercel
vercel Bot temporarily deployed to Preview – coss-com-origin October 20, 2026 12:24 Inactive
@vercel

vercel Bot commented Oct 20, 2026

Copy link
Copy Markdown

Deployment failed for project coss-com with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: coss-com.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@uixmat
uixmat enabled auto-merge (squash) October 20, 2026 12:55
- Item recipe paints the active pill again; a visible indicator suppresses it,
  so selection survives SSR and compositions without the indicator
- Measure the indicator with sub-pixel precision like Base UI Tabs.Indicator
- Merge a consumer ref instead of overriding the internal one
- Observe attributes on direct children only
- Navigation particles no longer prevent default link navigation
- Tabs indicator respects reduced motion

Co-authored-by: Cursor <cursoragent@cursor.com>
@uixmat
uixmat merged commit 36213ac into main Oct 20, 2026
13 checks passed
@uixmat
uixmat deleted the acting-as-a-main branch October 20, 2026 14:41
@linear-code

linear-code Bot commented Oct 20, 2026

Copy link
Copy Markdown

DES-242

This branch was successfully deployed

3 active and 1 inactive deployments
Preview – coss-com-ui — f9f500c8 Deployed Oct 20, 2026 by vercel[bot]
Preview – coss-examples-calcom — f9f500c8 Deployed Oct 20, 2026 by vercel[bot]
Preview – coss-com — f9f500c8 Deployed Oct 20, 2026 by vercel[bot]
Preview – coss-com-origin — f9f500c8 Deployed Oct 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants