Tabs¶
Tabs are used to separate information into logical sections in the context of a single page and to quickly navigate between them.
Usage¶
When to use¶
- Use tabs to group content that belongs to the same category.
- Use tabs when there is a large amount of content that can be separated.
- Use tabs to make the content accessible without navigating across pages or compromising on space.
- Different tab-panes should be logically related but mutually exclusive. A content element should only be in one tab at a time.
Best practices¶
- Don't mix different content types within the same tab structure.
- Avoid nested tabs (2 levels of tabs stacked on top of each other) since they add visual complexity, and are harder to navigate.
Design¶
Elements¶
- Active tab, 2. Badge (optional), 3. Default tab, 4. Overflow menu
Tab label¶
- The label describes the content contained within it.
- Labels are concise and use no more than two words.
- Tab labels should be written in title case and all words should be proper nouns.
- The label will not be truncated and uses the space it needs.
- The minimum width of a tab is
124px
.
Number of tabs¶
In most scenarios, you should use no more than six tabs. This ensures an uncluttered UI and reduces cognitive load for users. If more than six tabs are needed, consider other navigation patterns.
Order¶
The order of all tabs should be consistent across all pages. Tabs with related content should be grouped adjacent to each other. The most important tab should be the first.
Badge¶
A small badge (dot) can be displayed in tabs to indicate when new information is available. The badge can also contain a number to display the amount of notifications.
Icon tabs¶
If there is not enough space to display meaningful labels, a tab version with icons can be used.
Note: This version only works with meaningful icons!
Closable tabs¶
This variation allows users to open multiple tabs for multitasking or comparing information side by side, and subsequently close them as needed. They can be used in combination with badges.
Note: Closable tabs cannot be used in combination with icons.
Responsive behavior¶
When there isn’t enough space to display all the tabs, the ones that no longer fit collapse into a menu. This menu contains all the tabs in the same order, ensuring consistent navigation while optimizing space.
Code¶
Element provides its own tab component to allow for the desired responsive behavior.
Usage¶
si-tabs
can be imported using the module
import { SiTabsModule } from '@siemens/element-ng/tabs';
@NgModule({
imports: [SiTabsModule, ...]
})
or as a standalone component:
import { SiTabComponent, SiTabsetComponent } from '@siemens/element-ng/tabs';
@Component({
imports: [
SiTabComponent,
SiTabsetComponent,
...
]
})
Tabs - Basic¶
Tabs - Responsive Behavior¶
SiTabsetComponent API Documentation¶
si-tabset
Input Properties¶
Name | Type | Default | Description |
---|---|---|---|
selectDefaultTab ¶ | boolean | true | If selectDefaultTab is passed as 'false', this implies no default tab selection i.e. on initial load of tabset component no tab gets selected. |
selectedTabIndex ¶ | number | Returns the currently selected tab index. Sets a selected tab index. This will activate the tab of the provided index, activates the tab and fires a notification about the change. If index is passed as -1 i.e. selectedTabIndex = -1 , this implies to clear all tab selection. | |
tabButtonMaxWidth ¶ | number | Define an optional max-width in px for the tab buttons. The minimum value is 100 . |
Output Properties¶
Name | Type | Description |
---|---|---|
(readonly) deselect ¶ | EventEmitter <SiTabDeselectionEvent > | Event emitter to notify when a tab became inactive. |
(readonly) selectedTabIndexChange ¶ | EventEmitter <number > | Event emitter to notify about selected tab index changes. You can either use bi-directional binding with [(selectedTabIndex)] or separate both with [selectedTabIndex]=... and (selectedTabIndexChange)=... |
SiTabComponent API Documentation¶
si-tab
Input Properties¶
Name | Type | Default | Description |
---|---|---|---|
badgeColor ¶ | string | Background color of the badge. If no color is provided a red dot badge will be rendered. | |
badgeContent ¶ | (boolean | TranslatableString ) | Additional badge content. A value of - true will render a red dot - any string without a badgeColor will render a red dot with text - any string with a badgeColor will render a normal badge | |
closable ¶ | boolean | false | Close the current tab. |
disabled ¶ | boolean | false | Disables the tab. |
heading ¶ | TranslatableString | Title of the tab item. | |
icon ¶ | string | Icon of the tab item. | |
iconAltText ¶ | TranslatableString | Alternative name or translation key for icon. Used for A11y. |
Output Properties¶
Name | Type | Description |
---|---|---|
(readonly) closeTriggered ¶ | EventEmitter <SiTabComponent > | Event emitter to notify when a tab is closed. |
Types Documentation¶
|
Represents a translatable string. This can either be a translation key, e.g. ACTIONS.EDIT that will be automatically translated when displayed on the UI or a pre-translated string, e.g. Edit . Equivalent to a normal string in usage and functionality. |
---|
Translatable import imported from @siemens/element-translate-ng |
---|
Except where otherwise noted, content on this site is licensed under MIT License.