Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions css/_tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,22 @@
@include exports('tabs-container-disabled-hover') {
@include tabs-container-disabled-hover;
}

/// Container type: do not apply fixed 10rem width to nav links.
/// Default tabs get width: 10rem at 42rem viewport from base Carbon styles
/// (including :focus and :active); container tabs should size naturally.
/// @access private
/// @group components
@mixin tabs-container-nav-link-width {
@media (min-width: 42rem) {
.#{$prefix}--tabs--container .#{$prefix}--tabs__nav-link,
.#{$prefix}--tabs--container .#{$prefix}--tabs__nav-link:focus,
.#{$prefix}--tabs--container .#{$prefix}--tabs__nav-link:active {
width: auto;
}
}
}

@include exports('tabs-container-nav-link-width') {
@include tabs-container-nav-link-width;
}
2 changes: 1 addition & 1 deletion css/all.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/g10.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/g100.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/g80.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/g90.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/white.css

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion docs/src/pages/components/Tabs.svx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Use the `icon` prop to render an icon next to the tab label. The icon is rendere

## Container type

Use the container type for a more prominent tab interface.
Use the container type for a more prominent tab interface. By default, container types have an auto-width.

<Tabs type="container">
<Tab label="Tab label 1" />
Expand All @@ -117,6 +117,21 @@ Use the container type for a more prominent tab interface.
</svelte:fragment>
</Tabs>

## Container type (full width)

Combine `type="container"` with `fullWidth` for container tabs that evenly span the full width of the container.

<Tabs type="container" fullWidth>
<Tab label="Tab label 1" />
<Tab label="Tab label 2" />
<Tab label="Tab label 3" />
<svelte:fragment slot="content">
<TabContent>Content 1</TabContent>
<TabContent>Content 2</TabContent>
<TabContent>Content 3</TabContent>
</svelte:fragment>
</Tabs>

## Container type (disabled)

Container type tabs with disabled states. Set `disabled` to `true` on individual tabs to prevent interaction.
Expand Down
Loading