Tabs
Class: FxTabs · Tag: <fx-tabs> · Mixins: Animatable
Child: FxTab · Tag: <fx-tab>
The <fx-tabs> component is a tabbed container for HMI dashboards. Nest <fx-tab> pages with headers, optional per-tab selection colors, badges, and icons; each page can hold displays, indicators, or other controls.
Installation
Section titled “Installation”import '@salsafx/ui';Interactive preview of a plant operator console:
Basic Usage
Section titled “Basic Usage”Shared selection color
Section titled “Shared selection color”Set selection-color on <fx-tabs> when every tab should use the same highlight. Individual tabs omit their own color.
<fx-tabs selected-index="0" selection-color="#38bdf8" is-animated> <fx-tab header="Generator" icon="fa-solid fa-bolt"> <fx-display layout="vertical" gap="10px" size="small"> <fx-display-region label="Voltage" value="690" suffix="V" value-template="888" ></fx-display-region> <fx-display-region label="Current" value="1.42" suffix="kA" value-template="8.88" ></fx-display-region> <fx-display-region label="Frequency" value="50.02" suffix="Hz" value-template="88.88" foreground-color="#38bdf8" ></fx-display-region> </fx-display> </fx-tab> <fx-tab header="Cooling" icon="fa-solid fa-snowflake"> <fx-led-indicator label="Pump A" color="#38bdf8" is-active></fx-led-indicator> <fx-led-indicator label="Pump B" color="#64748b"></fx-led-indicator> <fx-led-indicator label="Fan" color="#38bdf8" is-active></fx-led-indicator> </fx-tab> <fx-tab header="Grid" icon="fa-solid fa-plug"> <fx-display layout="vertical" gap="10px" size="small"> <fx-display-region label="Export" value="3.18" suffix="MW" value-template="8.88" foreground-color="#84cc16" ></fx-display-region> <fx-display-region label="PF" value="0.98" value-template="8.88" ></fx-display-region> </fx-display> </fx-tab></fx-tabs>Icons, badges, and per-tab colors
Section titled “Icons, badges, and per-tab colors”Set icon on a tab (icon-font classes or a .svg path), or slot a custom <fx-icon> / markup with slot="icon". Use badge for counts, and selection-color on a tab to override the container default.
<fx-tabs selected-index="1" is-animated> <fx-tab header="Day" selection-color="#eab308" icon="fa-solid fa-sun"> <fx-display size="medium"> <fx-display-region label="Setpoint" value="12.0" suffix="MW" value-template="88.8" ></fx-display-region> </fx-display> </fx-tab> <fx-tab header="Alarms" selection-color="#ef4444" badge="8"> <fx-icon slot="icon" icon="fa-solid fa-triangle-exclamation"></fx-icon> 8 open alarms — acknowledge from the alarm list. </fx-tab> <fx-tab header="Night" selection-color="#a855f7"> <fx-icon slot="icon" icon="fa-solid fa-moon"></fx-icon> <fx-display size="medium"> <fx-display-region label="Setpoint" value="4.5" suffix="MW" value-template="88.8" ></fx-display-region> </fx-display> </fx-tab></fx-tabs>With is-animated, active tab highlights transition smoothly and the selected page fades in. Omit the attribute (or set it to false) for an instant switch.
API Reference
Section titled “API Reference”<fx-tabs> — Properties & Attributes
Section titled “<fx-tabs> — Properties & Attributes”| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
selectedIndex | selected-index | Number | 0 | Zero-based index of the selected tab. |
selectionColor | selection-color | String | "#f59e0b" | Default highlight color for selected tabs that do not set their own. |
alignX | align-x | String | "center" | Default horizontal content alignment for nested tabs ("left", "center", "right", "stretch"). |
alignY | align-y | String | "center" | Default vertical content alignment for nested tabs ("top", "center", "bottom", "stretch"). |
padding | padding | String | "" | Default padding for nested tabs that do not set their own. |
isAnimated | is-animated | Boolean | true | Enables fluid, hardware-accelerated transitions on the tab strip and panel. |
disabled | disabled | Boolean | false | Disables tab selection. |
<fx-tabs> — Events
Section titled “<fx-tabs> — Events”| Event | Detail | Description |
|---|---|---|
change | { index, tab } | Fired when the user selects a different tab. |
<fx-tabs> — Slots
Section titled “<fx-tabs> — Slots”| Name | Description |
|---|---|
default | Nested <fx-tab> pages. |
<fx-tabs> — CSS Custom Properties
Section titled “<fx-tabs> — CSS Custom Properties”| Property | Default | Description |
|---|---|---|
--fx-tabs-background | #0c0e12 | Panel / selected-tab fill. |
--fx-tabs-nav-background | #080b10 | Tab strip background. |
--fx-tabs-nav-border | #2a3a4a | Border under the tab strip. |
--fx-font-family | sans-serif | Font stack for tab headers. |
<fx-tab>
Section titled “<fx-tab>”| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
header | header | String | "" | Label shown on the tab button. |
icon | icon | String | "" | Icon-font class list or a path ending in .svg; creates a header icon. |
selectionColor | selection-color | String | "" | Highlight color when this tab is selected; falls back to the parent. |
badge | badge | String | "" | Optional badge text on the tab button (e.g. alarm count). |
selected | selected | Boolean | false | Reflects whether this tab is currently selected. |
disabled | disabled | Boolean | false | Prevents selecting this tab. |
alignX | align-x | String | "" | Horizontal content alignment; falls back to the parent. |
alignY | align-y | String | "" | Vertical content alignment; falls back to the parent. |
padding | padding | String | "" | Padding inside the tab page; falls back to the parent. |
| Slot | Description |
|---|---|
default | Tab page content. |
icon | Custom header icon (overrides the icon attribute when slotted). |
Object Hierarchy
Section titled “Object Hierarchy”classDiagram
direction TB
class FxElement
class FxContainerElement
class FxContentElement
class FxTabs
FxElement <|-- FxContainerElement
FxContainerElement <|-- FxContentElement
FxContentElement <|-- FxTabs : Animatable
classDiagram
direction TB
class FxElement
class FxContainerElement
class FxContentElement
class FxTab
FxElement <|-- FxContainerElement
FxContainerElement <|-- FxContentElement
FxContentElement <|-- FxTab
See also Architecture.
© 2026 SalsaFX.PlutonKrea s.r.o.All rights reserved |Contact| SalsaFX v4.62.3