Toggler -- on/off switch.
Props
is_toggled(boolean) -- whether the toggler is on. Default: false.label(string) -- text label displayed next to the toggler.spacing(number) -- space between toggler and label in pixels.width(length) -- widget width. Default: shrink. SeeToddy.Iced.Length.size(number) -- toggler size in pixels.text_size(number) -- label text size in pixels.font(string | map) -- label font. SeeToddy.Iced.Font.line_height(number | map) -- label line height.text_shaping(atom) -- text shaping::basic,:advanced, or:auto. SeeToddy.Iced.Shaping.wrapping(atom) -- text wrapping::none,:word,:glyph,:word_or_glyph. SeeToddy.Iced.Wrapping.text_alignment(atom) -- horizontal label alignment::left,:center,:right. SeeToddy.Iced.Alignment.style(atom) -- named style. Currently only:default.disabled(boolean) -- when true, the toggler cannot be toggled. Default: false.a11y(map) -- accessibility overrides. SeeToddy.Iced.A11y.
Events
%Widget{type: :toggle, id: id, value: bool}-- emitted on toggle,valueis the new boolean state.
Summary
Functions
Sets accessibility annotations.
Converts this toggler struct to a ui_node() map via the Toddy.Iced.Widget protocol.
Sets whether the toggler is disabled.
Sets the label font.
Sets the toggler label.
Sets the label line height.
Creates a new toggler struct with the given toggle state and optional keyword opts.
Sets the toggler size in pixels.
Sets the spacing between toggler and label.
Sets the toggler style.
Sets the horizontal label text alignment.
Sets the text shaping strategy.
Sets the label text size in pixels.
Sets the toggler width.
Applies keyword options to an existing toggler struct.
Sets the text wrapping mode.
Types
@type option() :: {:label, String.t()} | {:spacing, number()} | {:width, Toddy.Iced.Length.t()} | {:size, number()} | {:text_size, number()} | {:font, Toddy.Iced.Font.t()} | {:line_height, number() | map()} | {:text_shaping, Toddy.Iced.Shaping.t()} | {:wrapping, Toddy.Iced.Wrapping.t()} | {:text_alignment, Toddy.Iced.Alignment.t()} | {:style, style()} | {:disabled, boolean()} | {:a11y, Toddy.Iced.A11y.t()}
@type style() :: :default | Toddy.Iced.StyleMap.t()
@type t() :: %Toddy.Iced.Widget.Toggler{ a11y: Toddy.Iced.A11y.t() | nil, disabled: boolean() | nil, font: Toddy.Iced.Font.t() | nil, id: String.t(), is_toggled: boolean(), label: String.t() | nil, line_height: number() | map() | nil, size: number() | nil, spacing: number() | nil, style: style() | nil, text_alignment: Toddy.Iced.Alignment.t() | nil, text_shaping: Toddy.Iced.Shaping.t() | nil, text_size: number() | nil, width: Toddy.Iced.Length.t() | nil, wrapping: Toddy.Iced.Wrapping.t() | nil }
Functions
@spec a11y(toggler :: t(), a11y :: Toddy.Iced.A11y.t()) :: t()
Sets accessibility annotations.
@spec build(toggler :: t()) :: Toddy.Iced.ui_node()
Converts this toggler struct to a ui_node() map via the Toddy.Iced.Widget protocol.
Sets whether the toggler is disabled.
@spec font(toggler :: t(), font :: Toddy.Iced.Font.t()) :: t()
Sets the label font.
Sets the toggler label.
Sets the label line height.
Creates a new toggler struct with the given toggle state and optional keyword opts.
Sets the toggler size in pixels.
Sets the spacing between toggler and label.
Sets the toggler style.
@spec text_alignment(toggler :: t(), text_alignment :: Toddy.Iced.Alignment.t()) :: t()
Sets the horizontal label text alignment.
@spec text_shaping(toggler :: t(), text_shaping :: Toddy.Iced.Shaping.t()) :: t()
Sets the text shaping strategy.
Sets the label text size in pixels.
@spec width(toggler :: t(), width :: Toddy.Iced.Length.t()) :: t()
Sets the toggler width.
Applies keyword options to an existing toggler struct.
@spec wrapping(toggler :: t(), wrapping :: Toddy.Iced.Wrapping.t()) :: t()
Sets the text wrapping mode.