Tab
sl-tab
Tabs are used inside tab groups to represent and activate tab panels.
Examples
Basic Tab
<sl-tab>Tab</sl-tab> <sl-tab active>Active</sl-tab> <sl-tab closable>Closable</sl-tab> <sl-tab disabled>Disabled</sl-tab>
sl-tab Tab sl-tab active=true Active sl-tab closable=true Closable sl-tab disabled=true Disabled
Additional demonstrations can be found in the tab group examples.
Component Props
Note: The following appear as options in the Properties table but are currently not part of the Teamshares Design System. Please check with the design team before using these options:
- Boolean
closable
Property | Default | Details |
---|---|---|
panel
|
''
|
The name of the tab panel this tab is associated with. The panel must be located in the same tab group. |
active
|
false
|
Draws the tab in an active state. |
closable
|
false
|
Makes the tab closable and shows a close button. |
disabled
|
false
|
Disables the tab and prevents selection. |
updateComplete
|
A read-only promise that resolves when the component has finished updating. |
Learn more about attributes and properties.
Slots
Name | Details |
---|---|
(default) | The tab’s label. |
Learn more about using slots.
Events
Name | Name | Name | React Event | Details | |
---|---|---|---|---|---|
sl-close
|
sl-close
|
sl-close
|
onSlClose
|
Emitted when the tab is closable and the close button is activated. |
Learn more about events.
Methods
Name | Details |
---|---|
focus()
|
Sets focus to the tab. |
blur()
|
Removes focus from the tab. |
Learn more about methods.
Custom Properties
Name | Details |
---|---|
--group-track-width
|
Used to calculate the tab’s padding and border width. Must match the tab group’s track width (default is 1px). |
Learn more about customizing CSS custom properties.
CSS Parts
Name | Description |
---|---|
base
|
The component’s base wrapper. |
close-button
|
The close button, an <sl-icon-button> . |
close-button__base
|
The close button’s exported base part. |
Learn more about customizing CSS parts.
Dependencies
This component automatically imports the following dependencies.
-
<sl-icon>
-
<sl-icon-button>