Skip to content

Fader

Class: FxFader · Tag: <fx-fader> · Mixins: Animatable (via FxLinearTrackElement)

The <fx-fader> component is a skeuomorphic fader control for mixers, SCADA panels, and flight / HMI dashboards. It supports vertical and horizontal orientation, an optional recessed well, tick scales, and a value display.


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

import '@salsafx/ui';

Interactive preview of the main variants:


Drag the thumb to change the value. The default fill uses the theme three-stop gradient.

<fx-fader
value="62"
min="0"
max="100"
length="280"
is-animated
></fx-fader>

Snap-to-ticks calibration on both sides, with the built-in measure value display.

<fx-fader
value="40"
min="0"
max="100"
ticks="11"
sub-divisions="2"
snap-to-ticks
fit-ticks
has-scale-labels
ticks-side="left"
has-value-display
label="Level"
unit="%"
length="300"
style="--fx-bar-width: 110px;"
></fx-fader>

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

<fx-fader
value="62"
orientation="horizontal"
value-origin="start"
ticks="11"
sub-divisions="2"
snap-to-ticks
fit-ticks
has-scale-labels
ticks-side="left"
length="320"
style="--fx-bar-height: 110px;"
></fx-fader>

Set hasShell to false for a borderless flat look — no outer shell background or border.

<fx-fader
value="62"
min="0"
max="100"
orientation="horizontal"
value-origin="start"
ticks="11"
sub-divisions="2"
fit-ticks
has-scale-labels
ticks-side="left"
length="100%"
style="width: 100%; --fx-bar-height: 110px;"
></fx-fader>

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 selected value.
minminNumber0Minimum value.
maxmaxNumber100Maximum value.
orientationorientationString"vertical"Track direction (“vertical” or “horizontal”).
lengthlengthString""Length along the travel axis (preset token or custom length).
valueOriginvalue-originString"end"Which end of the track the fill grows from (“start” or “end”).
isAnimatedis-animatedBooleantrueEnables fluid, hardware-accelerated transitions when the value updates.
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.
snapToTickssnap-to-ticksBooleanfalseSnaps the thumb to major ticks.
fitTicksfit-ticksBooleanfalseAligns the end ticks with the center of the thumb at its minimum and maximum positions.
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-displayBooleanfalseShows the value display below the fader.
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> (layout offsets are synced by the fader).
displayOverrides the value display. Expects <fx-value-display>. Only rendered when has-value-display is set.
NameDetailDescription
input{ value: Number, displayValue: Number }Emitted continuously while dragging.
change{ value: Number, displayValue: Number }Emitted once when dragging ends.
PropertyDefaultDescription
--fx-bar-width97px (480px horizontal)Shell width. Prefer length for the travel axis.
--fx-bar-height480px (97px 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-width10pxTrack thickness (fixed for fader; use CSS var to override).
--fx-bar-well-pad5pxPadding inside the recessed well.
--fx-bar-well-backgroundvar(--fx-bar-background)Recessed well fill.
--fx-bar-thumb-size28pxThumb width and height.
--fx-bar-thumb-background#121a2bThumb face color.
--fx-bar-thumb-grip#000000Grip line color on the thumb.
--fx-bar-gradient-start#06b6d4Fill gradient start.
--fx-bar-gradient-middle#6366f1Fill gradient middle.
--fx-bar-gradient-end#a855f7Fill gradient end.

classDiagram
    direction TB
    class FxElement
    class FxMeasureElement
    class FxLinearTrackElement
    class FxFader

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

See also Architecture.