| Class name | Type | Description |
|---|---|---|
tabs |
Component | Container of multiple tab items |
tab |
Part | A single tab button (can be button, link, div, radio input, etc) |
tab-content |
Part | Tab content that comes immediately after a tab |
tabs-box |
Style | box style |
tabs-border |
Style | bottom border style |
tabs-lift |
Style | lift style |
tab-active |
Modifier | Makes a single tab look active |
tab-disabled |
Modifier | Makes a single tab look disabled |
tabs-top |
Placement | Puts tab buttons on top of the tab-content (default) |
tabs-bottom |
Placement | Puts tabs on under the tab-content |
tabs-xs |
Size | Extra small size |
tabs-sm |
Size | Small size |
tabs-md |
Size | Medium size |
tabs-lg |
Size | Large size |
tabs-xl |
Size | Extra large size |
<div role="tablist" class="tabs">
<a role="tab" class="tab">Tab 1</a>
<a role="tab" class="tab tab-active">Tab 2</a>
<a role="tab" class="tab">Tab 3</a>
</div>
Tabs(
[
Tab([Component.text('Tab 1')], role: 'tab'),
Tab([Component.text('Tab 2')], modifier: TabModifier.active, role: 'tab'),
Tab([Component.text('Tab 3')], role: 'tab'),
],
role: 'tablist',
);
<div role="tablist" class="tabs tabs-border">
<a role="tab" class="tab">Tab 1</a>
<a role="tab" class="tab tab-active">Tab 2</a>
<a role="tab" class="tab">Tab 3</a>
</div>
Tabs(
[
Tab([Component.text('Tab 1')], role: 'tab'),
Tab([Component.text('Tab 2')], modifier: TabModifier.active, role: 'tab'),
Tab([Component.text('Tab 3')], role: 'tab'),
],
style: [TabsStyle.border],
role: 'tablist',
);
<div role="tablist" class="tabs tabs-lift">
<a role="tab" class="tab">Tab 1</a>
<a role="tab" class="tab tab-active">Tab 2</a>
<a role="tab" class="tab">Tab 3</a>
</div>
Tabs(
[
Tab([Component.text('Tab 1')], role: 'tab'),
Tab([Component.text('Tab 2')], modifier: TabModifier.active, role: 'tab'),
Tab([Component.text('Tab 3')], role: 'tab'),
],
style: [TabsStyle.lift],
role: 'tablist',
);
<div role="tablist" class="tabs tabs-box">
<a role="tab" class="tab">Tab 1</a>
<a role="tab" class="tab tab-active">Tab 2</a>
<a role="tab" class="tab">Tab 3</a>
</div>
Tabs(
[
Tab([Component.text('Tab 1')], role: 'tab'),
Tab([Component.text('Tab 2')], modifier: TabModifier.active, role: 'tab'),
Tab([Component.text('Tab 3')], role: 'tab'),
],
style: [TabsStyle.box],
role: 'tablist',
);
<!-- name of each tab group should be unique -->
<div class="tabs tabs-box">
<input type="radio" name="my_tabs_1" class="tab" aria-label="Tab 1" />
<input type="radio" name="my_tabs_1" class="tab" aria-label="Tab 2" checked="checked" />
<input type="radio" name="my_tabs_1" class="tab" aria-label="Tab 3" />
</div>
Tabs(
[
input(
classes: 'tab',
type: InputType.radio,
name: 'my_tabs_1',
attributes: {'aria-label': 'Tab 1'},
),
input(
classes: 'tab',
type: InputType.radio,
name: 'my_tabs_1',
checked: true,
attributes: {'aria-label': 'Tab 2'},
),
input(
classes: 'tab',
type: InputType.radio,
name: 'my_tabs_1',
attributes: {'aria-label': 'Tab 3'},
),
],
style: [TabsStyle.box],
);
<div role="tablist" class="tabs tabs-lift tabs-xs">
<a role="tab" class="tab">Xsmall</a>
<a role="tab" class="tab tab-active">Xsmall</a>
<a role="tab" class="tab">Xsmall</a>
</div>
<div role="tablist" class="tabs tabs-lift tabs-sm">
<a role="tab" class="tab">Small</a>
<a role="tab" class="tab tab-active">Small</a>
<a role="tab" class="tab">Small</a>
</div>
<div role="tablist" class="tabs tabs-lift">
<a role="tab" class="tab">Medium</a>
<a role="tab" class="tab tab-active">Medium</a>
<a role="tab" class="tab">Medium</a>
</div>
<div role="tablist" class="tabs tabs-lift tabs-lg">
<a role="tab" class="tab">Large</a>
<a role="tab" class="tab tab-active">Large</a>
<a role="tab" class="tab">Large</a>
</div>
<div role="tablist" class="tabs tabs-lift tabs-xl">
<a role="tab" class="tab">Xlarge</a>
<a role="tab" class="tab tab-active">Xlarge</a>
<a role="tab" class="tab">Xlarge</a>
</div>
Component.fragment([
Tabs(
[
Tab([Component.text('Xsmall')], role: 'tab'),
Tab([Component.text('Xsmall')], modifier: TabModifier.active, role: 'tab'),
Tab([Component.text('Xsmall')], role: 'tab'),
],
style: [TabsStyle.lift],
size: TabsSize.xs,
role: 'tablist',
),
Tabs(
[
Tab([Component.text('Small')], role: 'tab'),
Tab([Component.text('Small')], modifier: TabModifier.active, role: 'tab'),
Tab([Component.text('Small')], role: 'tab'),
],
style: [TabsStyle.lift],
size: TabsSize.sm,
role: 'tablist',
),
Tabs(
[
Tab([Component.text('Medium')], role: 'tab'),
Tab([Component.text('Medium')], modifier: TabModifier.active, role: 'tab'),
Tab([Component.text('Medium')], role: 'tab'),
],
style: [TabsStyle.lift],
role: 'tablist',
),
Tabs(
[
Tab([Component.text('Large')], role: 'tab'),
Tab([Component.text('Large')], modifier: TabModifier.active, role: 'tab'),
Tab([Component.text('Large')], role: 'tab'),
],
style: [TabsStyle.lift],
size: TabsSize.lg,
role: 'tablist',
),
Tabs(
[
Tab([Component.text('Xlarge')], role: 'tab'),
Tab([Component.text('Xlarge')], modifier: TabModifier.active, role: 'tab'),
Tab([Component.text('Xlarge')], role: 'tab'),
],
style: [TabsStyle.lift],
size: TabsSize.xl,
role: 'tablist',
),
]);
Tab content 1
Tab content 2
Tab content 3
<!-- name of each tab group should be unique -->
<div class="tabs tabs-border">
<input type="radio" name="my_tabs_2" class="tab" aria-label="Tab 1" />
<div class="tab-content border-base-300 bg-base-100 p-10">Tab content 1</div>
<input type="radio" name="my_tabs_2" class="tab" aria-label="Tab 2" checked="checked" />
<div class="tab-content border-base-300 bg-base-100 p-10">Tab content 2</div>
<input type="radio" name="my_tabs_2" class="tab" aria-label="Tab 3" />
<div class="tab-content border-base-300 bg-base-100 p-10">Tab content 3</div>
</div>
Tabs(
[
input(
classes: 'tab',
type: InputType.radio,
name: 'my_tabs_2',
attributes: {'aria-label': 'Tab 1'},
),
TabContent([Component.text('Tab content 1')], classes: 'border-base-300 bg-base-100 p-10'),
input(
classes: 'tab',
type: InputType.radio,
name: 'my_tabs_2',
checked: true,
attributes: {'aria-label': 'Tab 2'},
),
TabContent([Component.text('Tab content 2')], classes: 'border-base-300 bg-base-100 p-10'),
input(
classes: 'tab',
type: InputType.radio,
name: 'my_tabs_2',
attributes: {'aria-label': 'Tab 3'},
),
TabContent([Component.text('Tab content 3')], classes: 'border-base-300 bg-base-100 p-10'),
],
style: [TabsStyle.border],
);
Tab content 1
Tab content 2
Tab content 3
<!-- name of each tab group should be unique -->
<div class="tabs tabs-lift">
<input type="radio" name="my_tabs_3" class="tab" aria-label="Tab 1" />
<div class="tab-content bg-base-100 border-base-300 p-6">Tab content 1</div>
<input type="radio" name="my_tabs_3" class="tab" aria-label="Tab 2" checked="checked" />
<div class="tab-content bg-base-100 border-base-300 p-6">Tab content 2</div>
<input type="radio" name="my_tabs_3" class="tab" aria-label="Tab 3" />
<div class="tab-content bg-base-100 border-base-300 p-6">Tab content 3</div>
</div>
Tabs(
[
input(
classes: 'tab',
type: InputType.radio,
name: 'my_tabs_3',
attributes: {'aria-label': 'Tab 1'},
),
TabContent([Component.text('Tab content 1')], classes: 'bg-base-100 border-base-300 p-6'),
input(
classes: 'tab',
type: InputType.radio,
name: 'my_tabs_3',
checked: true,
attributes: {'aria-label': 'Tab 2'},
),
TabContent([Component.text('Tab content 2')], classes: 'bg-base-100 border-base-300 p-6'),
input(
classes: 'tab',
type: InputType.radio,
name: 'my_tabs_3',
attributes: {'aria-label': 'Tab 3'},
),
TabContent([Component.text('Tab content 3')], classes: 'bg-base-100 border-base-300 p-6'),
],
style: [TabsStyle.lift],
);
Tab content 1
Tab content 2
Tab content 3
<!-- name of each tab group should be unique -->
<div class="tabs tabs-lift">
<label class="tab">
<input type="radio" name="my_tabs_4" />
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewbox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4 me-2">
<path stroke-linecap="round" stroke-linejoin="round" d="M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"></path>
</svg>
Live
</label>
<div class="tab-content bg-base-100 border-base-300 p-6">Tab content 1</div>
<label class="tab">
<input type="radio" name="my_tabs_4" checked="checked" />
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewbox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4 me-2">
<path stroke-linecap="round" stroke-linejoin="round" d="M15.182 15.182a4.5 4.5 0 0 1-6.364 0M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0ZM9.75 9.75c0 .414-.168.75-.375.75S9 10.164 9 9.75 9.168 9 9.375 9s.375.336.375.75Zm-.375 0h.008v.015h-.008V9.75Zm5.625 0c0 .414-.168.75-.375.75s-.375-.336-.375-.75.168-.75.375-.75.375.336.375.75Zm-.375 0h.008v.015h-.008V9.75Z"></path>
</svg>
Laugh
</label>
<div class="tab-content bg-base-100 border-base-300 p-6">Tab content 2</div>
<label class="tab">
<input type="radio" name="my_tabs_4" />
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewbox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4 me-2">
<path stroke-linecap="round" stroke-linejoin="round" d="M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z"></path>
</svg>
Love
</label>
<div class="tab-content bg-base-100 border-base-300 p-6">Tab content 3</div>
</div>
Tabs(
[
label(
[
input(type: InputType.radio, name: 'my_tabs_4'),
RawText(r'''<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewbox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4 me-2"><path stroke-linecap="round" stroke-linejoin="round" d="M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"></path></svg>'''),
Component.text('Live'),
],
classes: 'tab',
),
TabContent([Component.text('Tab content 1')], classes: 'bg-base-100 border-base-300 p-6'),
label(
[
input(type: InputType.radio, name: 'my_tabs_4', checked: true),
RawText(r'''<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewbox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4 me-2"><path stroke-linecap="round" stroke-linejoin="round" d="M15.182 15.182a4.5 4.5 0 0 1-6.364 0M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0ZM9.75 9.75c0 .414-.168.75-.375.75S9 10.164 9 9.75 9.168 9 9.375 9s.375.336.375.75Zm-.375 0h.008v.015h-.008V9.75Zm5.625 0c0 .414-.168.75-.375.75s-.375-.336-.375-.75.168-.75.375-.75.375.336.375.75Zm-.375 0h.008v.015h-.008V9.75Z"></path></svg>'''),
Component.text('Laugh'),
],
classes: 'tab',
),
TabContent([Component.text('Tab content 2')], classes: 'bg-base-100 border-base-300 p-6'),
label(
[
input(type: InputType.radio, name: 'my_tabs_4'),
RawText(r'''<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewbox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4 me-2"><path stroke-linecap="round" stroke-linejoin="round" d="M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z"></path></svg>'''),
Component.text('Love'),
],
classes: 'tab',
),
TabContent([Component.text('Tab content 3')], classes: 'bg-base-100 border-base-300 p-6'),
],
style: [TabsStyle.lift],
);
Tab content 1
Tab content 2
Tab content 3
<!-- name of each tab group should be unique -->
<div class="tabs tabs-lift tabs-bottom">
<input type="radio" name="my_tabs_5" class="tab" aria-label="Tab 1" />
<div class="tab-content bg-base-100 border-base-300 p-6">Tab content 1</div>
<input type="radio" name="my_tabs_5" class="tab" aria-label="Tab 2" checked="checked" />
<div class="tab-content bg-base-100 border-base-300 p-6">Tab content 2</div>
<input type="radio" name="my_tabs_5" class="tab" aria-label="Tab 3" />
<div class="tab-content bg-base-100 border-base-300 p-6">Tab content 3</div>
</div>
Tabs(
[
input(
classes: 'tab',
type: InputType.radio,
name: 'my_tabs_5',
attributes: {'aria-label': 'Tab 1'},
),
TabContent([Component.text('Tab content 1')], classes: 'bg-base-100 border-base-300 p-6'),
input(
classes: 'tab',
type: InputType.radio,
name: 'my_tabs_5',
checked: true,
attributes: {'aria-label': 'Tab 2'},
),
TabContent([Component.text('Tab content 2')], classes: 'bg-base-100 border-base-300 p-6'),
input(
classes: 'tab',
type: InputType.radio,
name: 'my_tabs_5',
attributes: {'aria-label': 'Tab 3'},
),
TabContent([Component.text('Tab content 3')], classes: 'bg-base-100 border-base-300 p-6'),
],
style: [TabsStyle.lift],
placement: TabsPlacement.bottom,
);
Tab content 1
Tab content 2
Tab content 3
<!-- name of each tab group should be unique -->
<div class="tabs tabs-box">
<input type="radio" name="my_tabs_6" class="tab" aria-label="Tab 1" />
<div class="tab-content bg-base-100 border-base-300 p-6">Tab content 1</div>
<input type="radio" name="my_tabs_6" class="tab" aria-label="Tab 2" checked="checked" />
<div class="tab-content bg-base-100 border-base-300 p-6">Tab content 2</div>
<input type="radio" name="my_tabs_6" class="tab" aria-label="Tab 3" />
<div class="tab-content bg-base-100 border-base-300 p-6">Tab content 3</div>
</div>
Tabs(
[
input(
classes: 'tab',
type: InputType.radio,
name: 'my_tabs_6',
attributes: {'aria-label': 'Tab 1'},
),
TabContent([Component.text('Tab content 1')], classes: 'bg-base-100 border-base-300 p-6'),
input(
classes: 'tab',
type: InputType.radio,
name: 'my_tabs_6',
checked: true,
attributes: {'aria-label': 'Tab 2'},
),
TabContent([Component.text('Tab content 2')], classes: 'bg-base-100 border-base-300 p-6'),
input(
classes: 'tab',
type: InputType.radio,
name: 'my_tabs_6',
attributes: {'aria-label': 'Tab 3'},
),
TabContent([Component.text('Tab content 3')], classes: 'bg-base-100 border-base-300 p-6'),
],
style: [TabsStyle.box],
);
Tab content 1
Tab content 2
Tab content 3
Tab content 4
<div class="overflow-x-auto max-w-60">
<div class="tabs-lift tabs min-w-max">
<input type="radio" name="my_tabs_7" class="tab z-1" aria-label="Tab title 1" />
<div class="sticky start-0 tab-content max-w-60 border-base-300 bg-base-100 p-6">Tab content 1</div>
<input type="radio" name="my_tabs_7" class="tab z-1" aria-label="Tab title 2" checked="checked" />
<div class="sticky start-0 tab-content max-w-60 border-base-300 bg-base-100 p-6">Tab content 2</div>
<input type="radio" name="my_tabs_7" class="tab z-1" aria-label="Tab title 3" />
<div class="sticky start-0 tab-content max-w-60 border-base-300 bg-base-100 p-6">Tab content 3</div>
<input type="radio" name="my_tabs_7" class="tab z-1" aria-label="Tab title 4" />
<div class="sticky start-0 tab-content max-w-60 border-base-300 bg-base-100 p-6">Tab content 4</div>
</div>
</div>
div(
[
Tabs(
[
input(
classes: 'tab z-1',
type: InputType.radio,
name: 'my_tabs_7',
attributes: {'aria-label': 'Tab title 1'},
),
TabContent(
[Component.text('Tab content 1')],
classes: 'sticky start-0 max-w-60 border-base-300 bg-base-100 p-6',
),
input(
classes: 'tab z-1',
type: InputType.radio,
name: 'my_tabs_7',
checked: true,
attributes: {'aria-label': 'Tab title 2'},
),
TabContent(
[Component.text('Tab content 2')],
classes: 'sticky start-0 max-w-60 border-base-300 bg-base-100 p-6',
),
input(
classes: 'tab z-1',
type: InputType.radio,
name: 'my_tabs_7',
attributes: {'aria-label': 'Tab title 3'},
),
TabContent(
[Component.text('Tab content 3')],
classes: 'sticky start-0 max-w-60 border-base-300 bg-base-100 p-6',
),
input(
classes: 'tab z-1',
type: InputType.radio,
name: 'my_tabs_7',
attributes: {'aria-label': 'Tab title 4'},
),
TabContent(
[Component.text('Tab content 4')],
classes: 'sticky start-0 max-w-60 border-base-300 bg-base-100 p-6',
),
],
classes: 'min-w-max',
style: [TabsStyle.lift],
),
],
classes: 'overflow-x-auto max-w-60',
);
<div role="tablist" class="tabs tabs-lift">
<a role="tab" class="tab">Tab 1</a>
<a role="tab" class="tab tab-active text-primary [--tab-bg:orange] [--tab-border-color:red]">Tab 2</a>
<a role="tab" class="tab">Tab 3</a>
</div>
Tabs(
[
Tab([Component.text('Tab 1')], role: 'tab'),
Tab(
[Component.text('Tab 2')],
classes: 'text-primary [--tab-bg:orange] [--tab-border-color:red]',
modifier: TabModifier.active,
role: 'tab',
),
Tab([Component.text('Tab 3')], role: 'tab'),
],
style: [TabsStyle.lift],
role: 'tablist',
);