Tabs
Switch between panels containing related content.
Usage guide
#Separate and switch related content within one context. Use Navigation across the app and Steps for sequential tasks.
Pair tabs with content
Match
sy-tab'stabkeytosy-tab-content'sname.Set the active tab
activestarts at 0. UsesetActiveTab()to switch in code.Many tabs or closable tabs
Use the overflow menu to navigate many tabs. Set
closableonly on tabs that need a close action.
Examples
#Feature examples
#Choose a feature from 24 topics. Explore property settings, method calls, event results, and slot layouts through live examples and code.
No matching features.
API reference
#Hover over a name or focus it with the keyboard to see the code. On touch screens, tap the name.
<sy-tab-group>
Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
number | undefined | Current tab index, starting at 0. | |
'center' | 'left' | 'left' | Left or center alignment of the tab row. | |
boolean | false | Block user interaction and keyboard focus. | |
boolean | false | Allow tabs to be reordered by dragging. | |
"top" | "bottom" | "left" | "right" | "top" | Item layout direction. | |
"card" | "line" | "line" | line or card style. | |
"small" | "medium" | "large" | "medium" | Component size. | |
"small" | "medium" | "large" | 'none' | "none" | Padding inside the tab area. | |
boolean | false | Provide an add button and the tabAdded event. The app creates the new tab. |
Events
| Event | Detail | Description |
|---|---|---|
CustomEvent<any> | Emitted when the user selects an item. | |
CustomEvent<any> | Read the result from the event's detail. | |
CustomEvent<HTMLSyTabElement[]> | Read the result from the event's detail. | |
CustomEvent<{ index: number; value: string }> | Read the result from the event's detail. | |
CustomEvent<{ index: number; value: string }> | Read the result from the event's detail. | |
CustomEvent<void> | Read the result from the event's detail. |
Methods
| Method | Returns | Description |
|---|---|---|
Promise<void> | Remove a tab and its associated content by index or tabkey. | |
Promise<void> | Select a tab by its zero-based index. | |
Promise<number | undefined> | Return the current tab index, or undefined if no tab is selected. |
Slots
| Slot | Description |
|---|---|
| Content displayed in the tabs area. | |
| Content displayed in the extra area. | |
| Component body or child items. | |
| Content displayed in the contents area. |
<sy-tab>
Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
boolean | false | Show the close button. | |
boolean | false | Block user interaction and keyboard focus. | |
string | undefined | Unique tab key associated with the content's name. | |
boolean | false | Emit only a close request. After confirmation, call closeTab on the parent. | |
boolean | false | Currently selected tab. Managed by the parent. | |
boolean | false | Disabled state passed down by the parent. | |
boolean | false | Final disabled state combining the parent and individual settings. | |
number | undefined | Item index calculated by the parent. | |
"card" | "line" | "line" | line or card style, passed down by the parent. | |
"small" | "medium" | "large" | "medium" | Component size. | |
"top" | "bottom" | "left" | "right" | "top" | Item layout direction. | |
boolean | false | Tab styling inside Global Header, set by the header. |
Events
| Event | Detail | Description |
|---|---|---|
CustomEvent<any> | Emitted when the user selects an item. | |
CustomEvent<any> | Read the result from the event's detail. |
Methods
| Method | Returns | Description |
|---|---|---|
Promise<void> | Close the item. |
Slots
| Slot | Description |
|---|---|
| Component body or child items. |
<sy-tab-content>
Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
boolean | false | Whether the content associated with the current tab is visible. Managed by the parent. | |
boolean | false | Block user interaction and keyboard focus. | |
string | undefined | Use the same value as the tabkey of the sy-tab to display. |
Slots
| Slot | Description |
|---|---|
| Component body or child items. |