InlineMessage: make variant prop optional#7922
Conversation
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>
🦋 Changeset detectedLatest commit: 216a2b5 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 |
|
There was a problem hiding this comment.
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.variantoptional and added a fallbackInfoIconwhenvariantis omitted. - Updated styling to fall back to
--fgColor-defaultwhen the variant-driven CSS variable is not set. - Added tests for the no-
variantcase 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
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>
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>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Overview
Makes the
variantprop onInlineMessageoptional. When no variant is specified:--fgColor-default)InfoIconThis change will not cause any regressions because all existing
InlineMessageusages were required to pass avariant— making the prop optional is purely additive.Changelog
New
InlineMessagecan now be rendered without avariantprop, displaying with the default foreground color and anInfoIconChanged
variantprop type changed from required to optionalRemoved
None
Rollout strategy
Testing & Reviewing
data-variantis not set and that an icon still rendersMerge checklist