Skip to content

Commit e8800d6

Browse files
committed
Fix issue with auto-expanding flex tabs
1 parent e71fe27 commit e8800d6

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
All notable changes to `dash` will be documented in this file.
33
This project adheres to [Semantic Versioning](https://semver.org/).
44

5+
## UNRELEASED
6+
7+
## Added
8+
- Modernized `dcc.Tabs`
9+
10+
## Changed
11+
- `dcc.Tab` now accepts a `width` prop which can be a pixel or percentage width for an individual tab.
12+
513
## [4.0.0rc2] - 2025-10-10
614

715
## Added

components/dash-core-components/src/components/Tabs.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const EnhancedTab = ({
5454
labelDisplay = (
5555
<ExternalWrapper
5656
component={label}
57-
componentPath={[...componentPath, 0]}
57+
componentPath={[...componentPath, 'props', 'label']}
5858
/>
5959
);
6060
} else {
@@ -190,10 +190,10 @@ function Tabs({
190190
const style = childProps.style ?? {};
191191
if (typeof childProps.width === 'number') {
192192
style.width = `${childProps.width}px`;
193-
style.flex = 'none';
193+
style.flex = '0 0 auto';
194194
} else if (typeof childProps.width === 'string') {
195195
style.width = childProps.width;
196-
style.flex = 'none';
196+
style.flex = '0 0 auto';
197197
}
198198

199199
return (

components/dash-core-components/src/components/css/tabs.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.tab-parent {
33
display: flex;
44
flex-direction: column;
5+
overflow: hidden;
56
}
67

78
/* Tab container (holds all tabs) */
@@ -16,13 +17,13 @@
1617

1718
/* Individual tab */
1819
.tab {
19-
flex: 1;
20+
flex: 1 1 0;
21+
min-width: 0;
2022
background-color: var(--tabs-background);
2123
border: 1px solid var(--tabs-border);
2224
border-bottom: none;
2325
padding: 20px 25px;
2426
transition: background-color, color 200ms;
25-
width: 100%;
2627
text-align: center;
2728
box-sizing: border-box;
2829
}

0 commit comments

Comments
 (0)