Toddy.Iced.Widget.VerticalSlider (Toddy v0.3.0)

Copy Markdown View Source

Vertical slider -- vertical 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.
  • height (length) -- slider height. Default: fill. See Toddy.Iced.Length.
  • default (number) -- default value (double-click resets to this).
  • shift_step (number) -- step increment when Shift is held.
  • rail_color (hex color) -- color for the slider rail (both active and inactive portions).
  • rail_width (number) -- rail thickness in pixels.
  • style -- :default or StyleMap.t() for custom styling. See Toddy.Iced.StyleMap.
  • a11y (map) -- accessibility overrides. See Toddy.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 vertical slider struct to a ui_node() map via the Toddy.Iced.Widget protocol.

Sets the default value (double-click resets to this).

Sets the slider height.

Creates a new vertical 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 vertical slider struct.

Types

option()

@type option() ::
  {:step, number()}
  | {:shift_step, number()}
  | {:default, number()}
  | {:width, Toddy.Iced.Length.t()}
  | {:height, Toddy.Iced.Length.t()}
  | {:rail_color, Toddy.Iced.Color.input()}
  | {:rail_width, number()}
  | {:style, style()}
  | {:a11y, Toddy.Iced.A11y.t()}

style()

@type style() :: :default | Toddy.Iced.StyleMap.t()

t()

@type t() :: %Toddy.Iced.Widget.VerticalSlider{
  a11y: Toddy.Iced.A11y.t() | nil,
  default: number() | nil,
  height: Toddy.Iced.Length.t() | 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

a11y(slider, a11y)

@spec a11y(vertical_slider :: t(), a11y :: Toddy.Iced.A11y.t()) :: t()

Sets accessibility annotations.

build(slider)

@spec build(vertical_slider :: t()) :: Toddy.Iced.ui_node()

Converts this vertical slider struct to a ui_node() map via the Toddy.Iced.Widget protocol.

default(slider, default)

@spec default(vertical_slider :: t(), default :: number()) :: t()

Sets the default value (double-click resets to this).

height(slider, height)

@spec height(vertical_slider :: t(), height :: Toddy.Iced.Length.t()) :: t()

Sets the slider height.

new(id, range, value, opts \\ [])

@spec new(
  id :: String.t(),
  range :: {number(), number()},
  value :: number(),
  opts :: [option()]
) :: t()

Creates a new vertical slider struct with the given range, value, and optional keyword opts.

rail_color(slider, rail_color)

@spec rail_color(vertical_slider :: t(), rail_color :: Toddy.Iced.Color.input()) ::
  t()

Sets the rail color.

rail_width(slider, rail_width)

@spec rail_width(vertical_slider :: t(), rail_width :: number()) :: t()

Sets the rail width in pixels.

shift_step(slider, shift_step)

@spec shift_step(vertical_slider :: t(), shift_step :: number()) :: t()

Sets the step increment when Shift is held.

step(slider, step)

@spec step(vertical_slider :: t(), step :: number()) :: t()

Sets the step increment.

style(slider, style)

@spec style(vertical_slider :: t(), style :: style()) :: t()

Sets the slider style.

width(slider, width)

@spec width(vertical_slider :: t(), width :: Toddy.Iced.Length.t()) :: t()

Sets the slider width.

with_options(slider, opts)

@spec with_options(vertical_slider :: t(), opts :: [option()]) :: t()

Applies keyword options to an existing vertical slider struct.