Skip to content

chore: Adds internal style api v2 to segmented control - #5243

Merged
vvaliyev merged 1 commit into
mainfrom
style-v2-segmented-control
Nov 4, 2026
Merged

vvaliyev merged 1 commit into
mainfrom
style-v2-segmented-control

Conversation

@vvaliyev

@vvaliyev vvaliyev commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Description

Adds the internal Style API v2 to Segmented control: root, segment (every segment button; the selected and disabled segments are targeted with [aria-pressed="true"] and :disabled), divider (the line between two segments) and select (replaces the component in constrained views, forwards to Select).

Known gap: the Select fallback renders only below the x-small viewport breakpoint, so the dev page shows it only at narrow widths.

The style-docs snapshot and the VR registration of the dev page follow in one PR for all components.

Tracker section: P3d34KdbCd6o.

Related links, issue #, if available: n/a

How has this been tested?

Unit tests for every slot and forward, dev page segmented-control/style-api-v2, build and lint green.

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The segmented-control dev page uses local selection state instead of AppContext URL parameters, preventing alternate selections from being targeted by test URLs or preserved in shared links.

1 open issue
What changed in this PR

Adds internal Style API v2 support to SegmentedControl, enabling slot-based customization and forwarding styles to its responsive Select fallback.

Changes:

  • Adds root, segment, and divider styling slots, plus Select style forwarding.
  • Introduces radius, focus-ring, and divider styling tokens.
  • Adds slot-wiring tests and a demo page with text and icon variants.
File Description
src/​segmented-control/​styles.scss Registers root tokens and documents styling slots.
src/​segmented-control/​segment.tsx Applies segment and divider slot classes to buttons.
src/​segmented-control/​segment.scss Connects radius, focus-ring, and divider styling tokens.
src/​segmented-control/​internal.tsx Defines slot types and forwards styles to Select.
src/​segmented-control/​internal-segmented-control.tsx Applies root styles and passes slots to segments.
src/​segmented-control/​__tests__/​style-api.test.tsx Tests slot classes, forwarding, and DOM prop isolation.
pages/​segmented-control/​style-api-v2.scss Defines customized segment states and shapes.
pages/​segmented-control/​style-api-v2.page.tsx Demonstrates styled text and icon segments.

Review effort: Balanced

}

function StyledSegmentedControl({ options, label, square }: StyledSegmentedControlProps) {
const [selectedId, setSelectedId] = useState('list');
@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.82%. Comparing base (d8d3fa2) to head (d5dfac0).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5243   +/-   ##
=======================================
  Coverage   97.82%   97.82%           
=======================================
  Files        1006     1006           
  Lines       32608    32625   +17     
  Branches    12106    12121   +15     
=======================================
+ Hits        31900    31917   +17     
+ Misses        702      666   -36     
- Partials        6       42   +36     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vvaliyev
vvaliyev marked this pull request as ready for review November 3, 2026 17:11
@vvaliyev
vvaliyev requested a review from a team as a code owner November 3, 2026 17:11
@vvaliyev
vvaliyev requested review from pan-kot and ywyyu17 and removed request for a team November 3, 2026 17:11
styleClassNames: {
root: styles.root,
segment: clsx(styles.segment, square && styles['segment-square']),
divider: styles.divider,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's include select slot to the demo as well - we can import select styles from select's test page, or use some minimal ones

@vvaliyev
vvaliyev added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit 1a6b6c2 Nov 4, 2026
69 checks passed
@vvaliyev
vvaliyev deleted the style-v2-segmented-control branch November 4, 2026 12:33

This branch was successfully deployed

3 active deployments
dev-pages-react18 — d5dfac0c Deployed Nov 4, 2026 by vvaliyev via deploy (React 18) / deploy #3164
dev-pages-react16 — d5dfac0c Deployed Nov 4, 2026 by vvaliyev via deploy (React 16) / deploy #3164
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.

3 participants