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
50%
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
0.75
Disabled
Use the disabled attribute to prevent interaction.
Disabled
Events
The slider emits
phx-change
events as the user drags the handle.
def handle_event("volume_change", %{"volume" => volume}, socket) do
{:noreply, assign(socket, volume: String.to_integer(volume))}
end