Slider

A linear slider component for continuous value adjustment with support for both horizontal and vertical orientations.

The Slider component provides a linear control for continuous value adjustment. It shares the same layout, parameter model, interaction, and accessibility as other vector components; see the Vector introduction.

  • Multiple visual variants: abstract, trackless, trackfull, stripless
  • Flexible orientation: horizontal and vertical layouts
  • Extensive cursor customization: image-based cursors, custom styling, aspect ratio control
  • Full theming support: color, roundness, thickness customization

Props

NameTypeDefaultRequiredDescription
valuenumberYesCurrent value of the control
onChange(event: AudioControlEvent<number>) => voidNoHandler for value changes
minnumberNoMinimum value (ad-hoc mode)
maxnumberNoMaximum value (ad-hoc mode)
stepnumber1NoStep size for value adjustments
bipolarbooleanfalseNoWhether the component should operate in bipolar mode (centered at zero)
labelstringNoLabel displayed below the component
variant"abstract" | "trackless" | "trackfull" | "stripless"abstractNoVisual variant of the slider
orientation"horizontal" | "vertical"verticalNoOrientation of the slider
thicknessnumber0.5NoThickness of the slider (normalized 0.0-1.0, maps to 1-50)
valueAsLabel"labelOnly" | "valueOnly" | "interactive"labelOnlyNoControls how the label and value are displayed
cursorSize"None" | "Strip" | "Track" | "Tick" | "Label"NoCursor size option - determines which component's width is used for the cursor
cursorAspectRationumberNoAspect ratio of the cursor
cursorRoundnessnumber | stringNoOverrides the roundness factor of the cursor. Defaults to `roundness`
cursorImageHrefstringNoOptional image URL to display as cursor
cursorClassNamestringNoOptional CSS class name for the cursor
cursorStyleReact.CSSPropertiesNoOptional inline styles for the cursor
colorstringNoComponent primary color - any valid CSS color value
roundnessnumberNoRoundness for component corners (normalized 0.0-1.0)
adaptiveSizebooleanfalseNoWhether the component stretches to fill its container
size"xsmall" | "small" | "normal" | "large" | "xlarge"normalNoSize of the component
parameterContinuousParameterNoAudio Parameter definition (Model). If provided, overrides min/max/step/label/bipolar from ad-hoc props
valueFormatter(value: number, parameterDef: AudioParameter) => string | undefinedNoCustom renderer for the value display
interactionMode"drag" | "wheel" | "both"bothNoInteraction mode
interactionSensitivitynumberNoSensitivity of the control (normalized value change per pixel/unit)
interactionDirectionInteractionDirectionNoDirection of the interaction

Basic Usage

The Slider component requires a value and onChange handler. By default, sliders are vertical:

BasicSlider.tsx

Orientation

Sliders can be oriented horizontally or vertically:

Vertical Slider

The default orientation, suitable for fader-style controls:

VerticalSlider.tsx

Horizontal Slider

Useful for pan controls and other horizontal adjustments:

HorizontalSlider.tsx

Variants

The Slider component supports four visual variants:

Abstract

The default variant with a clean, minimal design:

AbstractVariant.tsx

Trackless

A variant without a visible track:

TracklessVariant.tsx

Trackfull

A variant with a full track visible:

TrackfullVariant.tsx

Stripless

A variant without a value strip:

StriplessVariant.tsx

Cursor Customization

The Slider component provides extensive options for customizing the cursor appearance:

Cursor Size

The cursorSize prop determines which component's width is used for the cursor:

CursorSizeExample.tsx

Cursor Aspect Ratio

Control the aspect ratio of the cursor:

CursorAspectRatio.tsx

Cursor Roundness

Override the roundness of the cursor independently from the slider:

CursorRoundness.tsx

Custom Cursor Image

Use a custom image for the cursor:

CursorImage.tsx

Cursor Styling

Apply custom CSS classes or inline styles to the cursor:

CursorStyling.tsx

Theming

Vector components share common theming features; see Theming Features in the Vector introduction for an overview. The Slider component supports theming through the color and roundness props:

Color Customization

SliderColor.tsx

Roundness

Control the roundness of the slider track and cursor:

SliderRoundness.tsx

Thickness

Adjust the thickness of the slider track:

SliderThickness.tsx

Bipolar Mode

In bipolar mode, the slider visualizes values relative to a center point. This is ideal for pan controls:

BipolarSlider.tsx

Value Display

The valueAsLabel prop controls how the label and value are displayed:

SliderValueDisplay.tsx

Value Formatting

Customize how values are displayed using the valueFormatter prop:

SliderFormatter.tsx

Parameter Model

Use a parameter model for integration with audio parameter systems. The following example uses ad-hoc props; with the full library you would use createContinuousParameter and the parameter prop:

SliderParameterModel.tsx

Adaptive Sizing

The Slider component supports both fixed sizes and adaptive sizing. By default, the size of the component is driven by the Size System and their size attribute:

SliderSizing.tsx

Adaptive sizing allows the component to adapt to the size of its parent container, adjusting its dimensions intelligently without causing distortion (scaleToFit display mode). The fill display mode makes the component fill the entire container, potentially distorting it.

SliderAdaptiveSize.tsx

Interaction Modes

Control how users interact with the slider:

SliderInteraction.tsx

Adjust the sensitivity of interactions:

SliderSensitivity.tsx

Common Patterns

Volume Fader

A typical vertical volume fader:

VolumeFader.tsx

Pan Control

A horizontal pan control with bipolar mode:

PanControl.tsx

Next Steps