Overview of the Phoenix and LiveView Headless Slider Component
The Mishka Chelekom Headless Slider
ships zero opinionated styling
- only the semantic markup, full WAI-ARIA
wiring, pointer drag, and keyboard support (Arrow keys, Shift+Arrow / PageUp/PageDown,
Home/End). Pass a single
value
or a list of
values
for a range with two or more thumbs; range thumbs respect
min_steps_between_values
and a configurable
thumb_collision
behavior. Every part - label, value
readout, control, track, indicator,
and thumb
- is addressable through a
*_class
attribute, so you style it entirely with your own Tailwind
classes while the accessibility and behavior keep working underneath.
Base UI Slider example (Phoenix headless)
<.slider id="slider-hero" value={25} label="Volume" control_class="flex w-56 touch-none items-center py-3 select-none" track_class="h-1 w-full bg-neutral-200 select-none dark:bg-neutral-800" indicator_class="bg-neutral-950 select-none dark:bg-white" thumb_class="size-4 border border-neutral-950 bg-white select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950 dark:focus-visible:outline-white dark:border-white dark:bg-neutral-950" />
Range Slider
<.slider id="slider-range-slider" values={[25, 45]} thumb_labels={["Minimum value", "Maximum value"]} control_class="flex w-56 touch-none items-center py-3 select-none" track_class="h-1 w-full bg-neutral-200 select-none dark:bg-neutral-800" indicator_class="bg-neutral-950 select-none dark:bg-white" thumb_class="size-4 border border-neutral-950 bg-white select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950 dark:focus-visible:outline-white dark:border-white dark:bg-neutral-950" />
Edge Alignment
<.slider id="slider-edge-alignment" value={25} label="Volume" control_class="flex w-56 touch-none items-center py-3 select-none" track_class="h-1 w-full bg-neutral-200 select-none dark:bg-neutral-800" indicator_class="bg-neutral-950 select-none dark:bg-white" thumb_class="size-4 border border-neutral-950 bg-white select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950 dark:focus-visible:outline-white dark:border-white dark:bg-neutral-950" />
Vertical
<.slider id="slider-vertical" value={35} orientation="vertical" label="Volume" control_class="flex touch-none select-none data-[orientation=vertical]:h-32 data-[orientation=vertical]:px-3" track_class="bg-neutral-200 select-none dark:bg-neutral-800 data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1" indicator_class="bg-neutral-950 select-none dark:bg-white" thumb_class="size-4 border border-neutral-950 bg-white select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950 dark:focus-visible:outline-white dark:border-white dark:bg-neutral-950" />
Parts & data attributes
Each part carries a stable
data-part
and a structural
chelekom-slider__*
class you can target, plus orientation and drag state for styling.
| Part | data-part | State / ARIA | Purpose |
|---|---|---|---|
| Root | - | data-orientation, data-dragging, data-disabled | Carries the Slider hook; reads min/max/step/large_step/orientation/format from data-*. |
| Label | label | - | Accessible label, wired via aria-labelledby. |
| Value | value | data-orientation | Formatted value readout. |
| Control | control | data-orientation, data-dragging, data-disabled | Press to jump the nearest thumb; drag to move it. |
| Track | track | data-orientation | The visual track the thumbs travel along. |
| Indicator | indicator | data-orientation | The filled interval from the first thumb (or min) to the last. |
| Thumb | thumb | role="slider", aria-orientation, aria-valuemin, aria-valuemax, aria-valuenow, aria-valuetext, data-index, data-orientation, data-dragging, data-disabled | One per value; contains a hidden input for form submission. |
| Input | input | - | Hidden value carrier (single → name, range → name[]). |
Accessibility
Follows the
WAI-ARIA Slider (and multi-thumb) pattern
: each thumb is a
role="slider"
element focusable with Tab. Arrow keys move by
step
(Up/Right increase), Shift+Arrow or PageUp/PageDown move by
large_step
, and Home/End jump to the
minimum/maximum. Range thumbs keep their configured minimum gap and never cross past
each other unexpectedly, per the chosen thumb_collision behavior.