Range Slider
A dual-handle slider for selecting a range of values.
Default
With Labels
Display the selected range values alongside the slider.
With Labels
$200 - $800
With Tooltips
Enable tooltips to show values above the handles.
Tooltips
With Pips
Add tick marks with the
pips
option.
Pips
Custom Format
Use the
format
attribute to customize how values are displayed.
Custom Format
Disabled
Use the disabled attribute to prevent interaction.
Disabled
Events
The range slider emits events with both min and max values.
Use
on_slide
for real-time updates or
on_change
for final values.
def handle_event("price_change", %{"price_min" => min, "price_max" => max}, socket) do
{:noreply,
assign(socket,
price_min: String.to_integer(min),
price_max: String.to_integer(max)
)}
end
Form Parameters
When used in forms, the range slider submits two parameters:
{name}_min
and
{name}_max
.
# For a range slider with name="price"
# Form submission includes:
%{"price_min" => "200", "price_max" => "800"}