Skip to content

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

Open
jonrohan wants to merge 6 commits intomainfrom
remove_styled_react_components_all
Open

Removing all unused components from @primer/styled-react#7806
jonrohan wants to merge 6 commits intomainfrom
remove_styled_react_components_all

Conversation

@jonrohan
Copy link
Copy Markdown
Member

@jonrohan jonrohan commented May 6, 2026

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.
Copilot AI review requested due to automatic review settings May 6, 2026 02:56
@jonrohan jonrohan requested a review from a team as a code owner May 6, 2026 02:56
@jonrohan jonrohan requested a review from siddharthkp May 6, 2026 02:56
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 6, 2026

🦋 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
Name Type
@primer/styled-react Patch

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

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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
File Description
packages/styled-react/src/index.tsx Removes re-exports for the removed component wrappers, leaving core theming/BaseStyles utilities.
packages/styled-react/src/experimental.tsx Removed experimental entrypoint source.
packages/styled-react/src/deprecated.tsx Removed deprecated entrypoint source.
packages/styled-react/src/components/ActionList.tsx Removed ActionList wrapper implementation.
packages/styled-react/src/components/Box.tsx Removed Box wrapper implementation.
packages/styled-react/src/components/Button.tsx Removed Button wrapper implementation (and related sx helper logic).
packages/styled-react/src/components/Button.stories.tsx Removed Button Storybook story.
packages/styled-react/src/components/Dialog.tsx Removed Dialog wrapper implementation.
packages/styled-react/src/components/Flash.tsx Removed Flash wrapper implementation.
packages/styled-react/src/components/FormControl.tsx Removed FormControl wrapper implementation.
packages/styled-react/src/components/Header.tsx Removed Header wrapper implementation.
packages/styled-react/src/components/Heading.tsx Removed Heading wrapper implementation.
packages/styled-react/src/components/IconButton.tsx Removed IconButton wrapper implementation.
packages/styled-react/src/components/Label.tsx Removed Label wrapper implementation.
packages/styled-react/src/components/Link.tsx Removed Link wrapper implementation.
packages/styled-react/src/components/LinkButton.tsx Removed LinkButton wrapper implementation.
packages/styled-react/src/components/SegmentedControl.tsx Removed SegmentedControl wrapper implementation.
packages/styled-react/src/components/Spinner.tsx Removed Spinner wrapper implementation.
packages/styled-react/src/components/Text.tsx Removed Text wrapper implementation.
packages/styled-react/src/components/TextInput.tsx Removed TextInput wrapper implementation.
packages/styled-react/src/components/ToggleSwitch.tsx Removed ToggleSwitch wrapper implementation.
packages/styled-react/src/components/UnderlineNav.tsx Removed UnderlineNav wrapper implementation.
packages/styled-react/src/components/deprecated/TabNav.tsx Removed deprecated TabNav wrapper implementation.
packages/styled-react/src/components/deprecated/Octicon.tsx Removed deprecated Octicon wrapper implementation.
packages/styled-react/src/components/deprecated/DialogV1.tsx Removed deprecated DialogV1 wrapper implementation.
packages/styled-react/src/components/deprecated/ActionList.tsx Removed deprecated ActionList wrapper implementation.
packages/styled-react/src/tests/primer-react.browser.test.tsx Removed browser tests covering removed wrappers.
packages/styled-react/src/tests/primer-react-experimental.browser.test.tsx Removed experimental entrypoint browser tests.
packages/styled-react/src/tests/primer-react-deprecated.browser.test.tsx Removed deprecated entrypoint browser tests.
packages/styled-react/src/tests/Box.browser.test.tsx Removed Box-specific browser tests.
packages/styled-react/src/tests/exports.test.ts Updates export snapshot coverage to only the root entrypoint.
packages/styled-react/src/tests/deprecated-exports.test.ts Updates deprecated-export validation to only scan the root entrypoint.
packages/styled-react/src/tests/snapshots/exports.test.ts.snap Updates snapshots to reflect the reduced export surface.
packages/styled-react/script/generate-components-json Updates components.json generation to only scan src/index.tsx.
packages/styled-react/rollup.config.js Updates Rollup inputs to only build src/index.tsx.
packages/styled-react/package.json No 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
Copy link
Copy Markdown
Contributor

primer Bot commented May 6, 2026

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

@primer
Copy link
Copy Markdown
Contributor

primer Bot commented May 6, 2026

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

@github-actions github-actions Bot temporarily deployed to storybook-preview-7806 May 6, 2026 03:42 Inactive
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.

2 participants