Skip to content
🟦 HTML 🟦 CSS 🟦 JS
Tabs - Web Component
The Tabs component can be used imported from:
Playground
Parameters
...
Events
This component has events. Check the documentation about how to use the events.
Name | Payload | Description |
---|---|---|
change | boolean | Returns the new value of the "value" attribute |
Slots
This component has slots. Check the documentation about how to use the slots.
Name | Tags | Description |
---|---|---|
tab-<number> | span | Tab content |
tab-<number>-label | span | Tab label |
Parameters use
tabs
The tabs
attribute is an array of objects with the following properties:
name
(string): The name of the tab.icons
(string): The name of the icon shown in the tab.content
(string): The content of the tab.disabled
(boolean): Disables the tab.
An example:
Also using icons or disabling for the tabs:
We can use <option>
tags to define the values of tabs
:
The tabs content can be HTML if the tab-<index>
slots are used. The index starts on 1
:
HTML
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
CSS
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
JS
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
There's a third option for defining the tabs. If you're going to directly use the tab-
slots for the tabs content, you can set the name
and/or disabled directly on the slot:
HTML
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
CSS
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
JS
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
We can customize the tabs labels'content also using the tab-<index>-label
slots:
HTML
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
CSS
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
JS
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
model
The model
attribute is the index of the tab that is currently active. The value start in 1
, not 0
.
HTML - Lorem ipsum dolor sit amet, consectetur adipiscing elit.
CSS - Lorem ipsum dolor sit amet, consectetur adipiscing elit.
JS - Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Browser support
Detected engine:
Chromium
Webkit
Gecko