Skip to content

InlineMessage: make variant prop optional - #7922

Merged
primer[bot] merged 4 commits into
mainfrom
dylanatsmith/inline-message-optional-variant
Jun 5, 2026
Merged

InlineMessage: make variant prop optional#7922
primer[bot] merged 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>
CopilotAI review requested due to automatic review settings June 3, 2026 17:49
@dylanatsmith
dylanatsmith requested a review from a team as a code ownerJune 3, 2026 17:49
@changeset-bot

changeset-botBot commented Jun 3, 2026

Copy link
Copy Markdown

🦋 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
NameType
@primer/reactMinor

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-actionsgithub-actionsBot 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-actionsgithub-actionsBot 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

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

CopilotAI 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.

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
FileDescription
packages/react/src/InlineMessage/InlineMessage.tsxMakes variant optional; adds default icon behavior and avoids setting data-variant when absent.
packages/react/src/InlineMessage/InlineMessage.test.tsxAdds coverage for the no-variant scenario (attribute omission + icon presence).
packages/react/src/InlineMessage/InlineMessage.module.cssAdds a CSS variable fallback so text color defaults correctly without a variant.
.changeset/inline-message-optional-variant.mdDeclares a minor release for the new optional-variant behavior.

Copilot's findings

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

Comment threadpackages/react/src/InlineMessage/InlineMessage.tsx
Comment threadpackages/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-actionsBot 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-actionsBot requested a deployment to storybook-preview-7922 June 3, 2026 18:04 Abandoned
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
github-actionsBot requested a deployment to storybook-preview-7922 June 3, 2026 18:12 Abandoned
@github-actions
github-actionsBottemporarily deployed to storybook-preview-7922 June 3, 2026 18:23 Inactive
@dylanatsmith
dylanatsmith marked this pull request as ready for review June 4, 2026 14:28
@jonrohanjonrohan added the Canary Release Apply this label when you want CI to create a canary release of the current PR label Jun 4, 2026
@primer-integration

Copy link
Copy Markdown

Integration test results from github/github-ui PR:

Passed CI  Passed
Passed VRT  Passed
Passed Projects  Passed

All checks passed!

@dylanatsmith
dylanatsmith enabled auto-merge June 5, 2026 10:44
@primer
primerBot disabled auto-merge June 5, 2026 17:17
@primer
primerBot added this pull request to the merge queueJun 5, 2026
Merged via the queue into main with commit 55b7b04Jun 5, 2026
70 of 71 checks passed
@primer
primerBot deleted the dylanatsmith/inline-message-optional-variant branch June 5, 2026 17:26
@primerprimerBot mentioned this pull request Jun 5, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Canary ReleaseApply this label when you want CI to create a canary release of the current PRintegration-tests: recommendedThis change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpmstaffAuthor is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@dylanatsmith@jonrohan