-
Notifications
You must be signed in to change notification settings - Fork 646
Add leadingVisual to InlineMessage #7247
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: 07f5eee The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the |
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 pull request adds a new leadingVisual prop to the InlineMessage component, allowing users to provide custom icons or visual elements instead of the default variant-based icons. This enhances the component's flexibility and aligns with similar patterns used in other Primer React components like TextInput and ActionList.Item.
Key changes:
- Added
leadingVisualprop that acceptsReact.ElementType | React.ReactNode - Implementation uses
isValidElementTypeto determine whether to render as a component or node - Added comprehensive tests for various component types (icon, memo, forwardRef)
- Updated Storybook playground with a selector for different icon options
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| packages/react/src/InlineMessage/InlineMessage.tsx | Added leadingVisual prop type definition and implementation logic to conditionally render custom visual or default icon |
| packages/react/src/InlineMessage/InlineMessage.test.tsx | Added tests for custom leading visual with different React component types and default icon behavior |
| packages/react/src/InlineMessage/InlineMessage.stories.tsx | Updated Playground story with icon selector control to demonstrate custom leadingVisual options |
| .changeset/giant-loops-send.md | Added changeset for minor version bump documenting the new feature |
|
👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/7891 |
|
🟢 ci completed with status |
llastflowers
left a comment
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.
looks great! 🚀
Closes #6044
Changelog
Add
leadingVisualtoInlineMessage.Rollout strategy
Testing & Reviewing
Merge checklist