Overview
TheSliderRenderable 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
Slider orientation (required)
Initial value
Minimum value
Maximum value
Size of the viewport, affects thumb size. Larger viewport = larger thumb.
Track background color
Thumb color
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
TheviewPortSize 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:- Small viewport relative to content = small thumb
- Large viewport relative to content = large thumb