Repository navigation
chore: Adds internal style api v2 to tabs - #5256
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5256 +/- ##
=======================================
Coverage 97.86% 97.86%
=======================================
Files 1016 1016
Lines 32847 32850 +3
Branches 12176 12181 +5
=======================================
+ Hits 32146 32149 +3
Misses 695 695
Partials 6 6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the tab styling update.
No open issues 🎉
What changed in this PR
Moves default tab colors and typography to the tab container so future container-level styles can reach labels in every state, while keeping style.tab styling on the link.
Changes:
- Makes tab links inherit container typography and state colors while preserving action and dismiss styling.
- Adds tests confirming where
style.tab, indicator, and separator styles are applied. - Adds disabled-tab examples with text actions and dismiss buttons.
| File | Description |
|---|---|
src/tabs/tab-header-bar.scss |
Moves default typography and state colors to containers, preserving link-level overrides. |
src/tabs/__tests__/tabs.test.tsx |
Tests link and container style placement and padding passthrough. |
pages/tabs/actions.page.tsx |
Adds disabled tabs with text actions and dismiss buttons. |
Review effort: Balanced
c9e96ce to
1c7a262
Compare
1c7a262 to
1d3fb84
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The styled-tab selections use local state instead of the required AppContext URL parameters, so they are lost on reload and cannot be shared via links or directly targeted by integration tests.
1 open issue
2 resolved since last review
Review effort: Balanced
| const [activeId, setActiveId] = useState('one'); | ||
| const [containerActiveId, setContainerActiveId] = useState('one'); |
1d3fb84 to
32c4ae0
Compare
| const el = container.querySelector('.dismiss-root'); | ||
| expect(el).not.toBeNull(); |
32c4ae0 to
560b8dc
Compare
| const disabledTabs: TabsProps['tabs'] = [ | ||
| { id: 'one', label: 'Overview', content: 'Overview content.' }, | ||
| { id: 'two', label: 'Details', disabled: true, content: 'Details content.' }, | ||
| { id: 'three', label: 'History', content: 'History content.' }, |
There was a problem hiding this comment.
nit: I'd simplify the test page as most of the examples are identical. E.g. instead of having separate baseTabs and disabledTabs - we can have a single set of tabs with some tabs being disabled. In that case it is best to have more than 3 tabs so that we can see different combinations of edges. Likewise, we can add a tab with a dismiss button to the same set.
Then, we can style the same set of tabs differently with 2-3 style combinations, so as result we should have 2-3 styled versions of tabs instead of 9.
| flex: 1; | ||
| @include focus-visible.when-visible { | ||
| @include styles.container-focus(); | ||
| @include styles.windows-high-contrast-outline($offset: 2px); |
There was a problem hiding this comment.
Let's introduce a version of container-focus inside src/internal/styles/style-api.scss - same as we did for styled focus-highlgiht
| active-indicator-width, | ||
| var(#{custom-props.$styleTabsActiveIndicatorWidth}, awsui.$border-active-width) | ||
| ); | ||
| @if style-api.enabled() { |
There was a problem hiding this comment.
I'd drop the @if style-api.enabled() - it is just three lines of code, and by making those conditional we introduce a difference in styles between packages which can lead to package-specific regressions.
560b8dc to
5873ea4
Compare


Description
Adds the internal Style API v2 to Tabs:
tabsHeader,tab(a class name or a function of the tab),tabLink,content,dismissButtonforwards to Button.root. Nocontainerslot: a styled Container around a default-variant Tabs covers that case.Default rendering is unchanged.
The style-docs snapshot and the VR registration of the dev page follow in one PR for all components.
Tracker section: P3d34KdbCd6o.
Related links, issue #, if available: n/a
How has this been tested?
Unit tests for every slot and forward, dev page
tabs/style-api-v2, build and lint green.Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md.CONTRIBUTING.md.Security
checkSafeUrlfunction.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.