Skip to main content

Overview

The SliderRenderable component provides a visual slider for selecting numeric values within a range. It supports both horizontal and vertical orientations, mouse dragging, and viewport-based thumb sizing.

Basic Usage

Props

'horizontal' | 'vertical'
required
Slider orientation (required)
number
default:"min"
Initial value
number
default:"0"
Minimum value
number
default:"100"
Maximum value
number
default:"(max - min) * 0.1"
Size of the viewport, affects thumb size. Larger viewport = larger thumb.
ColorInput
default:"'#252527'"
Track background color
ColorInput
default:"'#9a9ea3'"
Thumb color
(value: number) => void
Callback fired when value changes

Events

change

Fired when the slider value changes.

Methods

value

Get or set the slider value.

min / max

Get or set the minimum and maximum values.

viewPortSize

Get or set the viewport size (affects thumb size).

backgroundColor / foregroundColor

Get or set colors.

Behavior

Mouse Interaction

  • Click on thumb: Drag to change value
  • Click on track: Jump to that position and start dragging
  • Drag: Hold and move mouse to adjust value

Viewport Size

The viewPortSize property determines the size of the thumb relative to the track. This is useful for representing scrollable content:
  • Larger viewport = larger thumb
  • When viewport equals the range, thumb fills the entire track
  • Common for scrollbars where viewport represents visible content

Rendering

The slider uses sub-character precision with Unicode block characters for smooth rendering:
  • Horizontal: Uses , , for half-cell precision
  • Vertical: Uses , , for half-cell precision

Examples

Horizontal Volume Slider

Vertical Scrollbar

RGB Color Picker

Temperature Control

Opacity Control

Advanced Usage

Custom Rendering

The slider uses a virtual coordinate system (2x resolution) internally for smooth sub-character rendering. You generally don’t need to worry about this, but it enables smooth dragging and precise thumb positioning.

Viewport-based Sizing

For scrollbar use cases:
The thumb size will automatically adjust based on the ratio of viewport to content:
  • Small viewport relative to content = small thumb
  • Large viewport relative to content = large thumb