Skip to content

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.


import '@salsafx/ui';

Interactive preview of a plant operator console:

Gearbox oil temp high14:22
Nacelle vibration warning13:58
Wind speed approaching cut-out13:41

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>

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.

Day production profile active.
8 open alarms — acknowledge from the alarm list.Highest severity: gearbox oil temperature.
Night curtailment profile active.
<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.


PropertyAttributeTypeDefaultDescription
selectedIndexselected-indexNumber0Zero-based index of the selected tab.
selectionColorselection-colorString"#f59e0b"Default highlight color for selected tabs that do not set their own.
alignXalign-xString"center"Default horizontal content alignment for nested tabs ("left", "center", "right", "stretch").
alignYalign-yString"center"Default vertical content alignment for nested tabs ("top", "center", "bottom", "stretch").
paddingpaddingString""Default padding for nested tabs that do not set their own.
isAnimatedis-animatedBooleantrueEnables fluid, hardware-accelerated transitions on the tab strip and panel.
disableddisabledBooleanfalseDisables tab selection.
EventDetailDescription
change{ index, tab }Fired when the user selects a different tab.
NameDescription
defaultNested <fx-tab> pages.
PropertyDefaultDescription
--fx-tabs-background#0c0e12Panel / selected-tab fill.
--fx-tabs-nav-background#080b10Tab strip background.
--fx-tabs-nav-border#2a3a4aBorder under the tab strip.
--fx-font-familysans-serifFont stack for tab headers.
PropertyAttributeTypeDefaultDescription
headerheaderString""Label shown on the tab button.
iconiconString""Icon-font class list or a path ending in .svg; creates a header icon.
selectionColorselection-colorString""Highlight color when this tab is selected; falls back to the parent.
badgebadgeString""Optional badge text on the tab button (e.g. alarm count).
selectedselectedBooleanfalseReflects whether this tab is currently selected.
disableddisabledBooleanfalsePrevents selecting this tab.
alignXalign-xString""Horizontal content alignment; falls back to the parent.
alignYalign-yString""Vertical content alignment; falls back to the parent.
paddingpaddingString""Padding inside the tab page; falls back to the parent.
SlotDescription
defaultTab page content.
iconCustom header icon (overrides the icon attribute when slotted).

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.