Slider -- horizontal range input.
Props
range(list) --[min, max]range as a two-element list. Default:[0, 100].value(number) -- current slider value. Defaults to range minimum.step(number) -- step increment.width(length) -- slider width. Default: fill. SeeToddy.Iced.Length.default(number) -- default value (double-click resets to this).height(number) -- slider track height in pixels.shift_step(number) -- step increment when Shift is held.circular_handle(boolean) -- use a circular handle instead of the default rectangular one. Default: false.rail_color(hex color) -- color for the slider rail (both active and inactive portions).rail_width(number) -- rail thickness in pixels.style--:defaultorStyleMap.t()for custom styling. SeeToddy.Iced.StyleMap.a11y(map) -- accessibility overrides. SeeToddy.Iced.A11y.
Events
%Widget{type: :slide, id: id, value: value}-- emitted continuously while dragging.%Widget{type: :slide_release, id: id, value: value}-- emitted when drag ends.
Summary
Functions
Sets accessibility annotations.
Converts this slider struct to a ui_node() map via the Toddy.Iced.Widget protocol.
Sets whether the slider handle is circular.
Sets the default value (double-click resets to this).
Sets the slider track height in pixels.
Creates a new slider struct with the given range, value, and optional keyword opts.
Sets the rail color.
Sets the rail width in pixels.
Sets the step increment when Shift is held.
Sets the step increment.
Sets the slider style.
Sets the slider width.
Applies keyword options to an existing slider struct.
Types
@type option() :: {:step, number()} | {:shift_step, number()} | {:default, number()} | {:width, Toddy.Iced.Length.t()} | {:height, number()} | {:circular_handle, boolean()} | {:rail_color, Toddy.Iced.Color.input()} | {:rail_width, number()} | {:style, style()} | {:a11y, Toddy.Iced.A11y.t()}
@type style() :: :default | Toddy.Iced.StyleMap.t()
@type t() :: %Toddy.Iced.Widget.Slider{ a11y: Toddy.Iced.A11y.t() | nil, circular_handle: boolean() | nil, default: number() | nil, height: number() | nil, id: String.t(), rail_color: Toddy.Iced.Color.t() | nil, rail_width: number() | nil, range: {number(), number()}, shift_step: number() | nil, step: number() | nil, style: style() | nil, value: number(), width: Toddy.Iced.Length.t() | nil }
Functions
@spec a11y(slider :: t(), a11y :: Toddy.Iced.A11y.t()) :: t()
Sets accessibility annotations.
@spec build(slider :: t()) :: Toddy.Iced.ui_node()
Converts this slider struct to a ui_node() map via the Toddy.Iced.Widget protocol.
Sets whether the slider handle is circular.
Sets the default value (double-click resets to this).
Sets the slider track height in pixels.
@spec new( id :: String.t(), range :: {number(), number()}, value :: number(), opts :: [option()] ) :: t()
Creates a new slider struct with the given range, value, and optional keyword opts.
@spec rail_color(slider :: t(), rail_color :: Toddy.Iced.Color.input()) :: t()
Sets the rail color.
Sets the rail width in pixels.
Sets the step increment when Shift is held.
Sets the step increment.
Sets the slider style.
@spec width(slider :: t(), width :: Toddy.Iced.Length.t()) :: t()
Sets the slider width.
Applies keyword options to an existing slider struct.