createSlider
Headless pointer dragging, keyboard stepping, step snapping, and thumb styles for single or multi-thumb range sliders.
createSlider is the headless interaction engine behind Moraine’s Slider component. It provides pointer capture dragging, keyboard arrow stepping, value clamping, step snapping, and thumb/range inline style calculations.
Import#
Features#
- Single & Multi-thumb: Supports numeric values or tuples (
[min, max]) for dual-thumb range selection. - Pointer Capture: Smooth pointer tracking that prevents cursor escape during fast mouse or touch gestures.
- Keyboard Stepping: Handles Arrow Left/Right/Up/Down, PageUp/PageDown, and Home/End.
- Orientation & Inversion: Supports horizontal or vertical orientation, as well as inverted axes and RTL.
Signature#
Usage Example#
src/CustomSlider.tsx