Slider
An input that allows selecting a value from a range by dragging a handle.
Default
With Label
Combine with a label and display the current value.
With Label
%
Custom Range
Configure the range with
min
,
max
, and
step
.
Custom Range
Float Mode
Use a decimal
step
value for floating-point precision.
Float Mode
Disabled
Use the disabled attribute to prevent interaction.
Disabled
Events
Pair the slider with an
output
element for instant local value display. Use
phx-change
when the value needs to update LiveView state.
def handle_event("volume_change", %{"volume" => volume}, socket) do
{:noreply, assign(socket, volume: String.to_integer(volume))}
end