Skip to content

Linear Gauge

Class: FxLinearGauge · Tag: <fx-linear-gauge> · Mixins: Animatable

The <fx-linear-gauge> component is a premium, capsule-style linear gauge designed to monitor temperature, liquid levels, fuel cells, and other critical telemetry limits. It supports both vertical and horizontal layouts, configurable gradient fills, and dual-scale configurations.


Register the component by importing it directly in your application entrypoint:

import '@salsafx/ui';

Interactive preview of the main variants:


Use the range slider below to adjust the active fill level and observe the smooth transitions.

Active Reading: 50 L
<fx-linear-gauge
value="8"
min="0"
max="100"
count="12"
sub-divisions="1"
value-origin="end"
ticks-side="both"
label="Fuel tank"
unit="L"
is-animated
></fx-linear-gauge>

Highly Segmented High-Precision Level Gauge

Section titled “Highly Segmented High-Precision Level Gauge”
<fx-linear-gauge
value="37"
min="0"
max="50"
count="13"
sub-divisions="2"
value-origin="start"
ticks-side="right"
label="Reactant Fluid"
></fx-linear-gauge>

A dual °C / °F scale with a custom blue → amber → red gradient.

Active Reading: 79 °C
<fx-linear-gauge
value="79"
min="-30"
max="100"
label="Reactor Temp"
unit="°C"
value-origin="end"
is-animated
style="
--fx-linear-gauge-width: 130px;
--fx-linear-gauge-height: 330px;
--fx-linear-gauge-gradient-start: #3b82f6;
--fx-linear-gauge-gradient-middle: #f59e0b;
--fx-linear-gauge-gradient-end: #ef4444;
"
>
<fx-linear-scale
slot="scale"
value="79"
min="-30"
max="100"
count="13"
sub-divisions="5"
side="left"
has-scale-connecting-line
caption="°C"
></fx-linear-scale>
<fx-linear-scale
slot="scale"
value="174.2"
min="-22"
max="212"
count="13"
sub-divisions="2"
side="right"
caption="°F"
has-scale-connecting-line
></fx-linear-scale>
</fx-linear-gauge>

Set orientation="horizontal" and size with --fx-linear-gauge-width / --fx-linear-gauge-height.

<fx-linear-gauge
value="65"
min="0"
max="100"
label="Process Temp"
unit="°C"
orientation="horizontal"
ticks-side="left"
value-origin="start"
caption="°C"
is-animated
style="
--fx-linear-gauge-width: 520px;
--fx-linear-gauge-height: 110px;
--fx-linear-gauge-gradient-start: #06b6d4;
--fx-linear-gauge-gradient-middle: #6366f1;
--fx-linear-gauge-gradient-end: #a855f7;
"
></fx-linear-gauge>

Set hasShell to false to hide the outer capsule and show only the track and scales.

<fx-linear-gauge
value="65"
min="0"
max="100"
label="Coolant"
unit="°C"
orientation="horizontal"
ticks-side="left"
count="11"
sub-divisions="2"
value-origin="end"
caption="°C"
is-animated
theme="dark"
style="
--fx-linear-gauge-width: clamp(280px, 70vw, 520px);
--fx-linear-gauge-height: 110px;
"
></fx-linear-gauge>

In markup, boolean false must be set via the property (element.hasShell = false) because a present has-shell attribute is always treated as true.


PropertyAttributeTypeDefaultDescription
valuevalueNumber0Current value.
minminNumber0Minimum value.
maxmaxNumber100Maximum value.
isAnimatedis-animatedBooleantrueEnables fluid, hardware-accelerated transitions when the value updates.
disableddisabledBooleanfalseDisables the control and prevents user interaction.
hasScaleLabelshas-scale-labelsBooleantrueShows numeric labels on major ticks.
ticksSideticks-sideString"left"Placement of the ticks relative to the gauge.
countcountNumber10Number of major ticks.
subDivisionssub-divisionsNumber5Minor divisions between major ticks.
hasValueDisplayhas-value-displayBooleantrueShows the value display below the gauge.
labellabelString""Text label for the value display.
unitunitString""Unit shown in the value display.
orientationorientation"vertical" | "horizontal""vertical"Layout orientation of the gauge and scale.
valueOriginvalue-origin"start" | "end""end"Which end of the track the fill grows from.
trackThicknesstrack-thickness"small" | "medium" | "large" | "x-large" | Number"medium"Thickness of the gauge fill track.
captioncaptionString""Optional caption drawn on the scale (e.g., %).
spacingspacingNumber4Spacing gap between the track and the tick marks.
hasScaleConnectingLinehas-scale-connecting-lineBooleanfalseDraws a baseline connecting the scale ticks.
themetheme"light" | "dark""dark"Color theme preset (“light” or “dark”).
isRoundedTrackis-rounded-trackBooleantrueRounds the corners of the track and fill.
isRoundedShellis-rounded-shellBooleantrueRounds the corners of the outer shell.
hasShellhas-shellBooleantrueShows the outer shell background and border.
NameDescription
scaleOverrides scale beside the capsule. Expects <fx-linear-scale>.
displayOverrides bottom telemetry display panel. Expects <fx-value-display>.
PropertyDefaultDescription
--fx-linear-gauge-width120px (V) / 480px (H)Outer layout boundary container width.
--fx-linear-gauge-height480px (V) / 120px (H)Outer layout boundary container height.
--fx-linear-gauge-shell-filltheme-dependentCapsule outer shell fill color.
--fx-linear-gauge-shell-stroketheme-dependentCapsule outer shell stroke color.
--fx-linear-gauge-track-color#0f172aEmpty well / chamber color inside the capsule.
--fx-linear-gauge-shadow-opacity0.20Opacity of the inset shadow inside the empty well (01).
--fx-linear-gauge-gradient-start#06b6d4Gradient color at the value origin end.
--fx-linear-gauge-gradient-middle#6366f1Midpoint gradient color.
--fx-linear-gauge-gradient-end#a855f7Gradient color at the opposite end.
--fx-linear-gauge-transitionFill transition timing when is-animated is enabled.
PropertyDefaultDescription
--fx-linear-scale-colortheme-dependentTick mark stroke color.
--fx-linear-scale-label-colortheme-dependentScale number and caption text color.
--fx-linear-scale-label-font-size9pxFont size for scale numbers and caption.
--fx-display-label-color#94a3b8Telemetry label text color below the gauge.
--fx-display-value-color#ffffffTelemetry value text color below the gauge.

classDiagram
    direction TB
    class FxElement
    class FxMeasureElement
    class FxLinearGauge

    FxElement <|-- FxMeasureElement
    FxMeasureElement <|-- FxLinearGauge : Animatable

See also Architecture.