Skip to content

Support React element icons in IconButton - #8450

Merged
joshblack merged 6 commits into
mainfrom
copilot/support-react-elements-in-iconbutton
Oct 15, 2026
Merged

joshblack merged 6 commits into
mainfrom
copilot/support-react-elements-in-iconbutton

Conversation

Copilot AI commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

IconButton’s component-only icon type prevents passing icons from Server Components. Accept React elements while preserving existing component-type usage:

<IconButton aria-label="Menu" icon={<KebabHorizontalIcon />} />

Changelog

New

  • IconButton: Accept React.ReactElement in the icon prop.

Changed

  • ActionBar: Handle React elements in inherited icon props, including overflow menus and menu-item visuals.
  • Documentation: Describe the Server Component-compatible icon form.

Removed

None.

Rollout strategy

Minor release; existing usage requires no migration.

  • No changes needed in github/github-ui
  • Needs changes in github/github-ui
  • Ships with feature flag(s)
  • Not sure
  • None

Testing & Reviewing

Review element and component-type compatibility across tooltip, loading, and ActionBar overflow paths. ButtonBase already supports element rendering; its implementation is unchanged.

@changeset-bot

changeset-bot Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 14c3ffe

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

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

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

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Copilot AI changed the title [WIP] Support React elements in IconButton for server components Support React element icons in IconButton Sep 28, 2026
Copilot AI requested a review from joshblack September 28, 2026 18:41
Updated IconButton and ActionBar to accept React elements as icons.
@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Sep 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

@joshblack joshblack 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.

@copilot our stories to use the react element approach for these components instead of the other option

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>

Copilot AI commented Sep 28, 2026

Copy link
Copy Markdown
Contributor Author

@copilot our stories to use the react element approach for these components instead of the other option

Updated the IconButton and ActionBar stories to use JSX icon elements in a26b80d, including the playground’s icon selector. Build, type checking, lint, and 395 targeted tests passed.

Copilot AI requested a review from joshblack September 28, 2026 19:24
@joshblack
joshblack marked this pull request as ready for review September 28, 2026 19:26
Copilot AI lite review requested due to automatic review settings September 28, 2026 19:26
@joshblack
joshblack requested a review from a team as a code owner September 28, 2026 19:26
@github-actions
github-actions Bot temporarily deployed to storybook-preview-8450 September 28, 2026 19:35 Inactive

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

@primer-integration

primer-integration Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Integration test results from github/github-ui PR:

Waiting  Changes   Waiting
Waiting  CI   Waiting
Passed  VRT   Passed
Waiting  Projects   Waiting

@github-actions github-actions Bot added integration-tests: failing Changes in this PR cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Sep 29, 2026
@joshblack joshblack added integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh and removed integration-tests: failing Changes in this PR cause breaking changes in gh/gh labels Sep 29, 2026
@joshblack
joshblack added this pull request to the merge queue Oct 5, 2026
@joshblack
joshblack removed this pull request from the merge queue due to a manual request Oct 5, 2026

@joshblack joshblack 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.

@copilot use React.ReactNode instead of ElementType

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>

Copilot AI commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

@copilot use React.ReactNode instead of ElementType

Updated the icon API to use React.ReactNode while retaining component icon support. Commit: 14c3ffe.

Copilot AI requested a review from joshblack October 6, 2026 15:28
@joshblack

Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

…-elements-in-iconbutton

# Conflicts:
#	packages/react/src/Button/ButtonBase.tsx

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>

Copilot AI commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Merged main and resolved the ButtonBase.tsx conflict, preserving both the ReactNode icon renderer and incoming feature-flag changes. Merge commit: 5536f82.

@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Oct 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, there are new commits since the last successful integration test. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

@github-actions
github-actions Bot temporarily deployed to storybook-preview-8450 October 15, 2026 15:49 Inactive
@joshblack joshblack added the integration-tests: skipped manually Changes in this PR do not require an integration test label Oct 15, 2026
@joshblack
joshblack added this pull request to the merge queue Oct 15, 2026
Merged via the queue into main with commit 1528a48 Oct 15, 2026
62 checks passed
@joshblack
joshblack deleted the copilot/support-react-elements-in-iconbutton branch October 15, 2026 16:32
@primer primer Bot mentioned this pull request Oct 15, 2026

This branch was successfully deployed

1 active and 1 inactive deployments
storybook-preview-8450 — 5536f826 Deployed Oct 15, 2026 by github-actions[bot]
github-pages — 5536f826 Deployed Oct 15, 2026 by Copilot via deploy-preview #33675
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm integration-tests: skipped manually Changes in this PR do not require an integration test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support React elements in components like IconButton for server components

4 participants