Skip to content

InlineMessage: make variant prop optional#7922

Draft
dylanatsmith wants to merge 4 commits into
mainfrom
dylanatsmith/inline-message-optional-variant
Draft

InlineMessage: make variant prop optional#7922
dylanatsmith wants to merge 4 commits into
mainfrom
dylanatsmith/inline-message-optional-variant

Conversation

@dylanatsmith
Copy link
Copy Markdown
Member

Overview

Makes the variant prop on InlineMessage optional. When no variant is specified:

  • The text renders with the default foreground color (--fgColor-default)
  • The icon defaults to Primer's InfoIcon

This change will not cause any regressions because all existing InlineMessage usages were required to pass a variant — making the prop optional is purely additive.

Changelog

New

  • InlineMessage can now be rendered without a variant prop, displaying with the default foreground color and an InfoIcon

Changed

  • variant prop type changed from required to optional

Removed

None

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

  • Tests added for the no-variant case verifying that data-variant is not set and that an icon still renders
  • All existing tests continue to pass unchanged

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Storybook)
  • Changes are SSR compatible
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

When no variant is specified, the component uses the default foreground
color and renders an InfoIcon as the leading visual.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 3, 2026 17:49
@dylanatsmith dylanatsmith requested a review from a team as a code owner June 3, 2026 17:49
@dylanatsmith dylanatsmith requested a review from jonrohan June 3, 2026 17:49
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 3, 2026

🦋 Changeset detected

Latest commit: 216a2b5

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

@github-actions github-actions Bot added the staff Author is a staff member label Jun 3, 2026
@dylanatsmith dylanatsmith marked this pull request as draft June 3, 2026 17:49
@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 Jun 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

⚠️ 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.

To publish a canary release for integration testing, apply the Canary Release label 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 updates InlineMessage so the variant prop is optional, introducing a default rendering that uses the standard foreground color and a default info icon when no variant is provided.

Changes:

  • Made InlineMessageProps.variant optional and added a fallback InfoIcon when variant is omitted.
  • Updated styling to fall back to --fgColor-default when the variant-driven CSS variable is not set.
  • Added tests for the no-variant case and introduced a changeset for a minor release.
Show a summary per file
File Description
packages/react/src/InlineMessage/InlineMessage.tsx Makes variant optional; adds default icon behavior and avoids setting data-variant when absent.
packages/react/src/InlineMessage/InlineMessage.test.tsx Adds coverage for the no-variant scenario (attribute omission + icon presence).
packages/react/src/InlineMessage/InlineMessage.module.css Adds a CSS variable fallback so text color defaults correctly without a variant.
.changeset/inline-message-optional-variant.md Declares a minor release for the new optional-variant behavior.

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 2

Comment thread packages/react/src/InlineMessage/InlineMessage.tsx
Comment thread packages/react/src/InlineMessage/InlineMessage.test.tsx
Remove the explicit color declaration from the base rule so that
InlineMessage without a variant inherits the natural foreground color
instead of being forced to a specific token. Color is now only set
when a data-variant attribute is present.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot requested a deployment to storybook-preview-7922 June 3, 2026 17:57 Abandoned
Set --inline-message-fgColor to var(--fgColor-default) in the base rule
and override it per data-variant attribute, restoring the single color
declaration pattern.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot requested a deployment to storybook-preview-7922 June 3, 2026 18:04 Abandoned
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants