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

Copy Markdown View Source

Progress bar -- displays progress within a range.

Props

  • range (list) -- [min, max] as a two-element list. Default: [0, 100].
  • value (number) -- current progress value. Default: 0.
  • width (length) -- bar width. Default: fill. See Toddy.Iced.Length.
  • height (length) -- bar height. Default: shrink.
  • style -- named preset atom (:primary (default), :secondary, :success, :danger, :warning) or StyleMap.t() for custom styling. See Toddy.Iced.StyleMap.
  • vertical (boolean) -- when true, renders the progress bar vertically.
  • a11y (map) -- accessibility overrides. See Toddy.Iced.A11y.

Summary

Functions

Sets accessibility annotations.

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

Sets the progress bar height.

Creates a new progress bar struct with the given range, value, and optional keyword opts.

Sets the progress bar style.

Renders the progress bar vertically.

Sets the progress bar width.

Applies keyword options to an existing progress bar struct.

Types

option()

@type option() ::
  {:width, Toddy.Iced.Length.t()}
  | {:height, Toddy.Iced.Length.t()}
  | {:style, style()}
  | {:vertical, boolean()}
  | {:a11y, Toddy.Iced.A11y.t()}

preset()

@type preset() :: :warning | :danger | :success | :secondary | :primary

style()

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

t()

@type t() :: %Toddy.Iced.Widget.ProgressBar{
  a11y: Toddy.Iced.A11y.t() | nil,
  height: Toddy.Iced.Length.t() | nil,
  id: String.t(),
  range: {number(), number()},
  style: style() | nil,
  value: number(),
  vertical: boolean() | nil,
  width: Toddy.Iced.Length.t() | nil
}

Functions

a11y(bar, a11y)

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

Sets accessibility annotations.

build(bar)

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

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

height(bar, height)

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

Sets the progress bar height.

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

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

Creates a new progress bar struct with the given range, value, and optional keyword opts.

style(bar, style)

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

Sets the progress bar style.

vertical(bar, vertical)

@spec vertical(progress_bar :: t(), vertical :: boolean()) :: t()

Renders the progress bar vertically.

width(bar, width)

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

Sets the progress bar width.

with_options(bar, opts)

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

Applies keyword options to an existing progress bar struct.