Skip to content

Removing all unused components from @primer/styled-react - #7806

Merged
jonrohan merged 6 commits into
mainfrom
remove_styled_react_components_all
May 14, 2026
Merged

Removing all unused components from @primer/styled-react#7806
jonrohan merged 6 commits into
mainfrom
remove_styled_react_components_all

Conversation

@jonrohan

@jonrohanjonrohan commented May 6, 2026

Copy link
Copy Markdown
Member

Overview

This PR removes all unused components from @primer/styled-react. These components were styled-components wrappers around @primer/react components that are no longer needed as consumers have migrated to @primer/react with CSS Modules.

The following components have been confirmed to have 0 usages in production:

Removed from @primer/styled-react (main entrypoint)

Removed from @primer/styled-react/deprecated entrypoint

Removed from @primer/styled-react/experimental entrypoint

Additional internal-only component files removed (never exported publicly)

  • FormControl.tsx
  • Header.tsx
  • LinkButton.tsx
  • SegmentedControl.tsx

The ./deprecated and ./experimental entrypoints have been removed from package.json exports since they are now empty.

What remains in @primer/styled-react

The package still exports theming utilities (ThemeProvider, useTheme, useColorSchemeVar, theme, themeGet), the sx prop utilities (sx, merge), and BaseStyles — all marked as deprecated.

Changelog

New

None

Changed

None

Removed

  • Removed all styled-components wrapper components from @primer/styled-react (ActionList, Box, Button, Dialog, Flash, Heading, IconButton, Label, Link, Spinner, Text, TextInput, ToggleSwitch, UnderlineNav)
  • Removed all deprecated components (ActionList, DialogV1, Octicon)
  • Removed experimental Dialog component
  • Removed ./deprecated and ./experimental entrypoints from package exports

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

All removed components have been verified to have 0 usages via primer-query (links above). Click any component link above to confirm zero usage.

Merge checklist

- Deleted deprecated components including Dialog, Flash, FormControl, Header, Heading, IconButton, Label, Link, LinkButton, SegmentedControl, Spinner, Text, TextInput, ToggleSwitch, UnderlineNav, and ActionList.
- Removed their respective type definitions and exports from the index and deprecated files.
- Updated the codebase to eliminate reliance on the `sx` prop for these components, encouraging the use of components from `@primer/react` with CSS Modules instead.
CopilotAI review requested due to automatic review settings May 6, 2026 02:56
@jonrohan
jonrohan requested a review from a team as a code ownerMay 6, 2026 02:56
@jonrohan
jonrohan requested a review from siddharthkpMay 6, 2026 02:56
@changeset-bot

changeset-botBot commented May 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ed89d86

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@primer/styled-reactPatch

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

CopilotAI 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.

Pull request overview

This PR removes previously-deprecated component wrappers from @primer/styled-react (and its ./deprecated + ./experimental entrypoints) now that their usage has dropped to zero, leaving only the remaining theming/BaseStyles-related exports.

Changes:

  • Removed many component wrapper implementations (and related stories/tests) from packages/styled-react/src/components/**.
  • Removed the @primer/styled-react/deprecated and @primer/styled-react/experimental source entrypoints and updated build/test tooling to only target src/index.tsx.
  • Updated export snapshots and the components.json generator inputs accordingly.
Show a summary per file
FileDescription
packages/styled-react/src/index.tsxRemoves re-exports for the removed component wrappers, leaving core theming/BaseStyles utilities.
packages/styled-react/src/experimental.tsxRemoved experimental entrypoint source.
packages/styled-react/src/deprecated.tsxRemoved deprecated entrypoint source.
packages/styled-react/src/components/ActionList.tsxRemoved ActionList wrapper implementation.
packages/styled-react/src/components/Box.tsxRemoved Box wrapper implementation.
packages/styled-react/src/components/Button.tsxRemoved Button wrapper implementation (and related sx helper logic).
packages/styled-react/src/components/Button.stories.tsxRemoved Button Storybook story.
packages/styled-react/src/components/Dialog.tsxRemoved Dialog wrapper implementation.
packages/styled-react/src/components/Flash.tsxRemoved Flash wrapper implementation.
packages/styled-react/src/components/FormControl.tsxRemoved FormControl wrapper implementation.
packages/styled-react/src/components/Header.tsxRemoved Header wrapper implementation.
packages/styled-react/src/components/Heading.tsxRemoved Heading wrapper implementation.
packages/styled-react/src/components/IconButton.tsxRemoved IconButton wrapper implementation.
packages/styled-react/src/components/Label.tsxRemoved Label wrapper implementation.
packages/styled-react/src/components/Link.tsxRemoved Link wrapper implementation.
packages/styled-react/src/components/LinkButton.tsxRemoved LinkButton wrapper implementation.
packages/styled-react/src/components/SegmentedControl.tsxRemoved SegmentedControl wrapper implementation.
packages/styled-react/src/components/Spinner.tsxRemoved Spinner wrapper implementation.
packages/styled-react/src/components/Text.tsxRemoved Text wrapper implementation.
packages/styled-react/src/components/TextInput.tsxRemoved TextInput wrapper implementation.
packages/styled-react/src/components/ToggleSwitch.tsxRemoved ToggleSwitch wrapper implementation.
packages/styled-react/src/components/UnderlineNav.tsxRemoved UnderlineNav wrapper implementation.
packages/styled-react/src/components/deprecated/TabNav.tsxRemoved deprecated TabNav wrapper implementation.
packages/styled-react/src/components/deprecated/Octicon.tsxRemoved deprecated Octicon wrapper implementation.
packages/styled-react/src/components/deprecated/DialogV1.tsxRemoved deprecated DialogV1 wrapper implementation.
packages/styled-react/src/components/deprecated/ActionList.tsxRemoved deprecated ActionList wrapper implementation.
packages/styled-react/src/tests/primer-react.browser.test.tsxRemoved browser tests covering removed wrappers.
packages/styled-react/src/tests/primer-react-experimental.browser.test.tsxRemoved experimental entrypoint browser tests.
packages/styled-react/src/tests/primer-react-deprecated.browser.test.tsxRemoved deprecated entrypoint browser tests.
packages/styled-react/src/tests/Box.browser.test.tsxRemoved Box-specific browser tests.
packages/styled-react/src/tests/exports.test.tsUpdates export snapshot coverage to only the root entrypoint.
packages/styled-react/src/tests/deprecated-exports.test.tsUpdates deprecated-export validation to only scan the root entrypoint.
packages/styled-react/src/tests/snapshots/exports.test.ts.snapUpdates snapshots to reflect the reduced export surface.
packages/styled-react/script/generate-components-jsonUpdates components.json generation to only scan src/index.tsx.
packages/styled-react/rollup.config.jsUpdates Rollup inputs to only build src/index.tsx.
packages/styled-react/package.jsonNo functional change shown in diff (formatting only).

Copilot's findings

Comments suppressed due to low confidence (1)

packages/styled-react/src/index.tsx:7

  • This PR removes a large set of public exports from @primer/styled-react (components and the ./deprecated + ./experimental entrypoints). The PR description marks this as a patch release, but the repo’s versioning guidance treats removing a component/public API as a breaking change (major). Please align the rollout strategy and add an appropriate Changeset for the package so the release type matches the API break.
  • Files reviewed: 30/31 changed files
  • Comments generated: 1

Comment on lines 18 to 21
export default defineConfig({
input: ['src/index.tsx', 'src/experimental.tsx', 'src/deprecated.tsx'],
input: ['src/index.tsx'],
external: dependencies.map(createPackageRegex),
plugins: [
@primer

primerBot commented May 6, 2026

Copy link
Copy Markdown
Contributor

🤖 Lint issues have been automatically fixed and committed to this PR.

@primer

primerBot commented May 6, 2026

Copy link
Copy Markdown
Contributor

🤖 Lint issues have been automatically fixed and committed to this PR.

@github-actions
github-actionsBottemporarily deployed to storybook-preview-7806 May 6, 2026 03:42 Inactive

@siddharthkpsiddharthkp left a comment

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.

Damn! 🔥

@siddharthkpsiddharthkp added the Canary Release Apply this label when you want CI to create a canary release of the current PR label May 6, 2026
@primer-integration

Copy link
Copy Markdown

👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/20028

@primer-integration

Copy link
Copy Markdown

Integration test results from github/github-ui:

Passed CI  Passed
Waiting VRT   Waiting
Passed Projects  Passed

@jonrohan
jonrohan added this pull request to the merge queueMay 14, 2026
Merged via the queue into main with commit 36a4922May 14, 2026
60 checks passed
@jonrohan
jonrohan deleted the remove_styled_react_components_all branch May 14, 2026 01:21
@primerprimerBot mentioned this pull request May 14, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Canary ReleaseApply this label when you want CI to create a canary release of the current PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@jonrohan@siddharthkp@francinelucca