-
Notifications
You must be signed in to change notification settings - Fork 646
Remove sx from the SegmentedControl component
#6741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 32f40fe The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks! |
size-limit report 📦
|
363f0f4 to
637b0d3
Compare
….com/primer/react into liuliu/remove-sx-from-segmentcontrol
|
👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/2155 |
….com/primer/react into liuliu/remove-sx-from-segmentcontrol
|
🟢 ci completed with status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes the sx prop from the SegmentedControl component and its sub-components (Button and IconButton), aligning with the broader effort to phase out styled-system support from Primer React components. The change updates both the main React package and the styled-react compatibility package to maintain backwards compatibility.
- Removes
sxprop support fromSegmentedControl,SegmentedControlButton, andSegmentedControlIconButtoncomponents - Adds compatibility wrappers in the styled-react package to preserve
sxfunctionality for legacy consumers - Updates component exports, documentation, and tests to reflect the removal
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/styled-react/src/index.tsx | Adds SegmentedControl wrapper components that preserve sx prop functionality |
| packages/styled-react/src/tests/primer-react.browser.test.tsx | Updates tests to verify sx prop support in styled-react package |
| packages/react/src/index.ts | Exports SegmentedControl type definitions |
| packages/react/src/tests/snapshots/exports.test.ts.snap | Updates snapshot with new exported types |
| packages/react/src/SegmentedControl/index.ts | Exports component type definitions |
| packages/react/src/SegmentedControl/SegmentedControlIconButton.tsx | Removes sx prop and BoxWithFallback usage |
| packages/react/src/SegmentedControl/SegmentedControlButton.tsx | Removes sx prop and BoxWithFallback usage |
| packages/react/src/SegmentedControl/SegmentedControl.tsx | Removes sx prop, exports type, and removes BoxWithFallback usage |
| packages/react/src/SegmentedControl/SegmentedControl.docs.json | Removes sx prop from documentation |
| packages/react/src/SegmentedControl/SegmentedControl.dev.stories.tsx | Removes sx-related stories |
| e2e/components/SegmentedControl.test.ts | Removes tests for sx-related stories |
| .changeset/witty-chicken-leave.md | Documents breaking change |
| // Width is now handled by CSS: 32px default, 100% when data-full-width is set on parent | ||
| className={classes.IconButton} |
Copilot
AI
Sep 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment mentions that width is handled by CSS using classes.IconButton, but this class is not defined in the visible changes and may not actually handle the width styling that was previously managed by the sx prop. This could result in incorrect styling behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reusing the IconButton className in SegmentedControl.module.css
|
Uh oh! @liuliu-dev, at least one image you shared is missing helpful alt text. Check your pull request body to fix the following violations:
Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image. Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.
|
Remove
sxfrom theSegmentedControlcomponentCloses #5834
sx usage, tracking here: https://github.com/github/primer/issues/5827
Rollout strategy