Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5206 +/- ##
==========================================
+ Coverage 97.74% 97.76% +0.01%
==========================================
Files 1000 1003 +3
Lines 32346 32552 +206
Branches 11965 12095 +130
==========================================
+ Hits 31616 31823 +207
+ Misses 685 684 -1
Partials 45 45 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The focus-ring example cannot be exercised by keyboard because its focus container has tabIndex={-1} and the static, non-dismissible item has no other focus trigger.
1 open issue
What changed in this PR
Adds internal Style API v2 support to Flashbar, allowing core-system consumers to customize message items and stacked notifications without adding props to the public interface.
Changes:
- Adds four styling slots:
item,icon,dismissButton, andnotificationBar, including per-item callbacks. - Integrates focus-ring tokens and notification-bar color inheritance.
- Adds slot-forwarding tests and a styled demo page.
| File | Description |
|---|---|
src/flashbar/styles.scss |
Declares item and icon slots, dismiss-button forwarding, and item focus-ring tokens. |
src/flashbar/non-collapsible-flashbar.tsx |
Resolves and forwards styling classes to individual messages. |
src/flashbar/internal-interfaces.ts |
Defines the internal styling-slot interface. |
src/flashbar/flash.tsx |
Applies classes to message elements and dismiss buttons. |
src/flashbar/collapsible.scss |
Adds notification-bar styling tokens and color inheritance. |
src/flashbar/collapsible-flashbar.tsx |
Applies classes to stacked messages, placeholders, and the notification bar. |
src/flashbar/__tests__/style-api.test.tsx |
Tests class forwarding, callbacks, unknown keys, and DOM prop filtering. |
pages/flashbar/style-api-v2.page.tsx |
Demonstrates styling slots and focus-ring customization. |
pages/flashbar/style-api-v2.page.scss |
Defines demo styles using generated styling mixins. |
Review effort: Balanced
vvaliyev
force-pushed
the
style-v2-flashbar
branch
from
October 30, 2026 10:52
66585c4 to
281ba31
Compare
Comment on lines
+29
to
+32
| <div> | ||
| <Box variant="awsui-key-label" margin={{ bottom: 'xs' }}> | ||
| {label} | ||
| </Box> |
| } | ||
|
|
||
| export type InternalFlashbarProps = FlashbarProps & | ||
| InternalBaseComponentProps & { styleClassNames?: FlashbarStyleClassNames }; |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
Adds an internal
styleClassNamesprop (Style API v2) to Flashbar. The prop is not on the publicFlashbarPropsinterface; it is typed onInternalFlashbarPropsfor core-system consumers.Four slots:
item:div.flash, one per message, in the flat list and in the expanded stack. In the collapsed stack the class is also applied to the placeholderli.flashelements, so the peeking edges take the item's colours. Accepts a class name or a function of the item,string | ({ item }) => string, so eachtypecan take its own class. Properties:color,background,border,border-radius,box-shadow(also replaces the shadow of the collapsed stack),padding. Tokens:--awsui-style-focus-ring-color,--awsui-style-focus-ring-width,--awsui-style-focus-ring-radius, carried to the ring ondiv.flash-focus-container::before.icon:div.flash-icon, the status icon or the spinner forloading. Property:color. Icon and Spinner usecurrentColor, so the consumer colour reaches both.dismissButton: forwards toButton.rootthroughstyleClassNames={{ root }}on the dismissInternalButton. Rendered fordismissibleitems. Documented withdocs-forward, no mixin of its own.notificationBar:div.notification-bar, the bar under the stacked messages that expands and collapses the stack. Rendered forstackItemswith more than one message;:hoverand:activecover the interaction states. Properties:color,background,border,border-radius,box-shadow,padding. Tokens: the three focus-ring tokens, carried to the ring onbutton.button::before.The
docs()calls carry the slot descriptions and thebox-shadowdescription, so the generated Style API docs match the tracker section. The focus-ring tokens are registered once, instyles.scss, for both slots.Two changes to the component's own CSS:
.header,.item-countand.buttonusecolor: inheritinstead of$color-text-notification-stack-bar. The bar already sets that colour on itself, so default rendering is unchanged. The v1 keystyle.notificationBar.root.color(default, hover, active) now takes effect; it was a no-op before. The Flashbarstyle-customdev page sets this key, so its VR baseline changes (bar text moves from white to the page'sneutral10).style-api.focus-highlightmixin from the width and colour custom properties, each with its design-token fallback. The--awsui-style-focus-ring-box-shadowcustom property is no longer declared or read in this component. In the console build this changes the CSS text of the twobox-shadowdeclarations and removes the two custom property declarations; the computed ring is identical because the same v1 custom properties and fallbacks are read.The existing v1 Style API (
styleprop,style.tsx, inline custom properties) is otherwise unchanged.Dev page:
pages/flashbar/style-api-v2.page.tsxwith three permutations through the generated mixins (flashbar.item,flashbar.icon,flashbar.notificationBar,button.root): a dismissible item with every row, the three focus-ring tokens, the icon and the dismiss button; the item callback with one class per type plus aloadingitem; a stacked flashbar with the callback on the placeholders and the notification bar with every row,:hoverand:active.The
style-docssnapshot is not regenerated here; one follow-up PR regenerates it for all components. The dev page is not registered in the VR suite yet; one follow-up PR registers allstyle-api-v2pages.Tracker section: P3d34KdbCd6o.
How has this been tested?
npm run buildpasses.lib/components-definitions/style-api-doc/flashbar.jsoncarries the four slots with the slot descriptions and thebox-shadowdescription. The compiled CSS registers each focus-ring@propertyonce and contains no--awsui-style-focus-ring-box-shadow.npx jest -c jest.unit.config.js src/flashbar: 14 suites, 226 tests pass.src/flashbar/__tests__/style-api.test.tsxcovers: each slot class lands on its element through the test-utils finders and unknown keys are ignored; the item callback resolves for the full item and for the collapsed placeholders of a stacked flashbar, and the notification bar class lands; the prop does not leak to the DOM.npx prettier --check,npx stylelint,npx eslintpass on the changed files.mainand for this branch and diffed them. Apart from the hashed class names, the differences arecolor: inheriton the bar's text elements, the two removed--awsui-style-focus-ring-box-shadowdeclarations, and the twobox-shadowdeclarations of the focus rings now composed from the width and colour custom properties with the same fallbacks.div.flash, on the placeholderli.flashelements and ondiv.notification-bar; the bar's header and button take the consumer colour; the focus rings of the item, the dismiss button and the bar's toggle button take the consumer tokens; axe reports no violations.style-custompage changes (bar text colour, see above); no other page should change.