Skip to content

Chore: make data-component attribute overridable#1190

Merged
francinelucca merged 4 commits intomainfrom
chore/patch-data-component
Apr 15, 2026
Merged

Chore: make data-component attribute overridable#1190
francinelucca merged 4 commits intomainfrom
chore/patch-data-component

Conversation

@francinelucca
Copy link
Copy Markdown
Member

This pull request allows consumers of the @primer/octicons React components to override the data-component attribute on the rendered SVG elements. It also adds tests to ensure the default and overridden behaviors work as expected.

@francinelucca francinelucca requested a review from a team as a code owner April 13, 2026 15:15
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 13, 2026

🦋 Changeset detected

Latest commit: aa9c187

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

This PR includes changesets to release 1 package
Name Type
@primer/octicons 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 enables consumers of the @primer/octicons React icon components to override the data-component attribute on the rendered <svg>, and adds tests verifying both the default and overridden behavior.

Changes:

  • Move the default data-component="Octicon" attribute so consumer-provided props can override it.
  • Add/extend unit tests in both octicons_react and octicons_styled to cover the override behavior.
  • Add a changeset entry documenting the patch.
Show a summary per file
File Description
lib/octicons_react/src/createIconComponent.js Reorders props on <svg> so data-component can be overridden via ...rest.
lib/octicons_react/src/tests/octicon.js Adds a test ensuring data-component override works for React icons.
lib/octicons_styled/src/tests/octicon.js Adds tests for default and overridden data-component in styled icons.
.changeset/data-component-override.md Records the change as a patch release note.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 6/6 changed files
  • Comments generated: 1

Comment thread lib/octicons_react/src/createIconComponent.js
@francinelucca francinelucca merged commit 38dfb0d into main Apr 15, 2026
11 checks passed
@francinelucca francinelucca deleted the chore/patch-data-component branch April 15, 2026 02:10
@primer primer Bot mentioned this pull request Apr 15, 2026
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