Skip to content

Linear Bar

Class: FxLinearBar · Tag: <fx-linear-bar> · Mixins: Animatable (via FxLinearTrackElement)

The <fx-linear-bar> component is a read-only linear level indicator featuring a sleek outer shell, a recessed track well, a vibrant gradient fill, and an optional tick-mark scale. Since it is designed purely for monitoring telemetry, it has no thumb and does not accept pointer input.

By default (is-segmented), the fill is segmented by subtle divider lines, creating a high-tech multi-cell look. Set is-segmented to false for a smooth, uninterrupted gradient fill.


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

import '@salsafx/ui';

Interactive preview of the main variants:


Segmented fill with value display. Drag the potentiometer to drive the bar.

<fx-linear-bar
value="62"
min="0"
max="100"
ticks="11"
length="280"
label="Level"
unit="%"
is-animated
></fx-linear-bar>

Ticks and labels on both sides of the track.

<fx-linear-bar
value="40"
min="0"
max="100"
ticks="11"
sub-divisions="2"
has-scale-labels
ticks-side="both"
label="Level"
unit="%"
caption="%"
length="300"
is-animated
></fx-linear-bar>

Horizontal orientation with ticks above (ticks-side="left") or below (ticks-side="right").

<fx-linear-bar
value="62"
min="0"
max="100"
orientation="horizontal"
value-origin="start"
ticks="11"
sub-divisions="2"
has-scale-labels
ticks-side="left"
label="Output"
unit="%"
length="100%"
is-animated
style="width: 100%;"
></fx-linear-bar>
<fx-linear-bar
value="35"
min="0"
max="100"
orientation="horizontal"
value-origin="start"
ticks="11"
sub-divisions="2"
has-scale-labels
ticks-side="right"
label="Gain"
unit="%"
length="100%"
track-thickness="large"
is-animated
style="
width: 100%;
--fx-bar-gradient-start: #a78bfa;
--fx-bar-gradient-middle: #8b5cf6;
--fx-bar-gradient-end: #7c3aed;
"
></fx-linear-bar>

Continuous fill (no segment lines) and rounded caps via is-rounded.

<fx-linear-bar
id="linear-bar-continuous"
value="68"
min="0"
max="100"
ticks="11"
label="Smooth"
unit="%"
length="260"
is-animated
style="
--fx-bar-gradient-start: #fb7185;
--fx-bar-gradient-middle: #f43f5e;
--fx-bar-gradient-end: #e11d48;
"
></fx-linear-bar>
<fx-linear-bar
value="55"
min="0"
max="100"
ticks="11"
label="Rounded"
unit="%"
length="260"
is-rounded
is-animated
style="
--fx-bar-gradient-start: #34d399;
--fx-bar-gradient-middle: #10b981;
--fx-bar-gradient-end: #059669;
"
></fx-linear-bar>
<script>
customElements.whenDefined('fx-linear-bar').then(() => {
const el = document.getElementById('linear-bar-continuous');
if (el) el.isSegmented = false;
});
</script>

Vertical bars at small, medium, and large side by side.

<fx-linear-bar
track-thickness="small"
value="45"
ticks="11"
label="Small"
unit="%"
length="260"
></fx-linear-bar>
<fx-linear-bar
track-thickness="medium"
value="62"
ticks="11"
label="Medium"
unit="%"
length="260"
></fx-linear-bar>
<fx-linear-bar
track-thickness="large"
value="78"
ticks="11"
label="Large"
unit="%"
length="260"
></fx-linear-bar>

PropertyAttributeTypeDefaultDescription
valuevalueNumber0Current level value.
minminNumber0Minimum value.
maxmaxNumber100Maximum value.
orientationorientationString"vertical"Track direction (“vertical” or “horizontal”).
lengthlengthString""Length along the travel axis (preset token or custom value).
valueOriginvalue-originString"end"Which end of the track the fill grows from (“start” or “end”).
trackThicknesstrack-thicknessString"medium"Track thickness preset: small (10px), medium (16px), large (24px), or a custom value.
isAnimatedis-animatedBooleantrueEnables fluid, hardware-accelerated transitions when the value updates.
isSegmentedis-segmentedBooleantrueDraws divider lines to split the fill into segments.
isRoundedis-roundedBooleanfalseRounds the corners of the track and fill.
disableddisabledBooleanfalseDisables the control and prevents user interaction.
hasWellhas-wellBooleantrueRecessed well around the track.
hasShellhas-shellBooleantrueShows the outer shell background and border.
ticksticksNumber0Number of major calibration ticks. When segmented, this determines the number of segments.
hasScaleLabelshas-scale-labelsBooleantrueShows numeric labels on major ticks.
ticksSideticks-sideString"left"Placement of the ticks relative to the track.
subDivisionssub-divisionsNumber5Minor divisions between major ticks.
spacingspacingNumber4Spacing gap between the track and the tick marks.
hasValueDisplayhas-value-displayBooleantrueShows the value display below the bar.
labellabelString""Text label for the value display.
unitunitString""Unit shown in the value display.
captioncaptionString""Optional caption drawn on the scale (e.g., %).
decimalsdecimalsNumber2Number of decimal places for the displayed value.
NameDescription
scaleOverrides the default scale. Expects <fx-linear-scale>.
displayOverrides the value display. Expects <fx-value-display>. Only rendered when has-value-display is set.
PropertyDefaultDescription
--fx-bar-width110px (480px horizontal)Shell width. Prefer length for the travel axis.
--fx-bar-height480px (110px horizontal)Shell height. Prefer length for the travel axis.
--fx-bar-radius22pxShell corner radius.
--fx-bar-background#1e293bShell background.
--fx-bar-border#334155Shell border color.
--fx-bar-track-color#0b111fUnfilled track color.
--fx-bar-track-width16px (medium)Track thickness. Prefer track-thickness (small / medium / large).
--fx-bar-well-pad5pxPadding inside the recessed well.
--fx-bar-well-backgroundvar(--fx-bar-background)Recessed well fill.
--fx-bar-gradient-start#06b6d4Fill gradient start.
--fx-bar-gradient-middle#6366f1Fill gradient middle.
--fx-bar-gradient-end#a855f7Fill gradient end.
--fx-linear-bar-segment-gap2pxThickness of the divider lines between cells.

classDiagram
    direction TB
    class FxElement
    class FxMeasureElement
    class FxLinearTrackElement
    class FxLinearBar

    FxElement <|-- FxMeasureElement
    FxMeasureElement <|-- FxLinearTrackElement : Animatable
    FxLinearTrackElement <|-- FxLinearBar

See also Architecture.