Skip to content

Commit 05d64ad

Browse files
francineluccaandreancardonatw15egankodiakhq[bot]
authored
fix(tabs): remove max-width (#13247)
* fix(tabs): remove max-width * docs(tabs): add max width guidance * docs(tabs): format --------- Co-authored-by: Andrea N. Cardona <cardona.n.andrea@gmail.com> Co-authored-by: TJ Egan <tw15egan@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent b0f39f3 commit 05d64ad

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

packages/react/src/components/Tabs/Tabs.mdx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ import { Tabs, TabList, Tab, TabPanels, TabPanel } from './Tabs';
1313

1414
- [Overview](#overview)
1515
- [Line Tabs](#line-tabs)
16-
- [Container Tabs](#container-tabs)
16+
- [Contained Tabs](#contained-tabs)
17+
- [Icon Tabs](#icon-tabs)
1718
- [Component API](#component-api)
18-
- [Tab `renderContent`](#tab-rendercontent)
19+
- [Tab - render content on click](#tab---render-content-on-click)
20+
- [V11](#v11)
21+
- [Tabs composition](#tabs-composition)
22+
- [Various updates](#various-updates)
23+
- [Max width](#max-width)
1924
- [Feedback](#feedback)
2025

2126
## Overview
@@ -144,6 +149,18 @@ minor tweaks in naming or implementation.
144149
- Because `renderButton` is no longer needed, the associated `tabIndex` prop has
145150
also been deprecated.
146151

152+
### Max width
153+
154+
In V11, tabs no longer have a max-width property set. Which means a tab title
155+
can span as wide as long it's title is. To override this behavior, you may use
156+
some style rules:
157+
158+
```css
159+
.cds--tabs__nav-link {
160+
max-width: 10rem;
161+
}
162+
```
163+
147164
## Feedback
148165

149166
Help us improve this component by providing feedback, asking questions on Slack,

packages/react/src/components/Tabs/Tabs.stories.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const Default = () => (
4444
<Tab>Tab Label 1</Tab>
4545
<Tab>Tab Label 2</Tab>
4646
<Tab disabled>Tab Label 3</Tab>
47-
<Tab>Tab Label 4 with a very long long label</Tab>
47+
<Tab>Tab Label 4</Tab>
4848
</TabList>
4949
<TabPanels>
5050
<TabPanel>Tab Panel 1</TabPanel>
@@ -77,9 +77,7 @@ export const Manual = () => (
7777
<Tab>Tab Label 1</Tab>
7878
<Tab>Tab Label 2</Tab>
7979
<Tab disabled>Tab Label 3</Tab>
80-
<Tab title="Tab Label 4 with a very long long label">
81-
Tab Label 4 with a very long long label
82-
</Tab>
80+
<Tab title="Tab Label 4">Tab Label 4</Tab>
8381
<Tab>Tab Label 5</Tab>
8482
</TabList>
8583
<TabPanels>
@@ -156,9 +154,7 @@ export const Contained = () => (
156154
<Tab>Tab Label 1</Tab>
157155
<Tab>Tab Label 2</Tab>
158156
<Tab disabled>Tab Label 3</Tab>
159-
<Tab title="Tab Label 4 with a very long long title">
160-
Tab Label 4 with a very long long title
161-
</Tab>
157+
<Tab title="Tab Label 4">Tab Label 4</Tab>
162158
<Tab>Tab Label 5</Tab>
163159
</TabList>
164160
<TabPanels>

packages/styles/scss/components/tabs/_tabs.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ $icon-tab-size: custom-property.get-var('icon-tab-size', rem(40px));
279279
}
280280

281281
overflow: hidden;
282-
max-width: 10rem;
283282
padding: $spacing-04 $spacing-05 $spacing-03;
284283
border-bottom: $tab-underline-color;
285284
color: $text-secondary;

0 commit comments

Comments
 (0)