Checkbox -- toggleable boolean input.
Props
checked(boolean) -- whether the checkbox is checked. Default: false.label(string) -- text label displayed next to the checkbox.spacing(number) -- space between checkbox and label in pixels.width(length) -- widget width. Default: shrink. SeeToddy.Iced.Length.size(number) -- checkbox 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-- text shaping strategy. SeeToddy.Iced.Shaping.wrapping-- text wrapping mode. SeeToddy.Iced.Wrapping.style-- named preset (:primary(default),:secondary,:success,:danger) orStyleMap.t(). SeeToddy.Iced.StyleMap.icon(map) -- custom icon for the check mark. Map with:code_point(required), and optional:size,:line_height,:font,:shaping.disabled(boolean) -- when true, the checkbox 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 checkbox struct to a ui_node() map via the Toddy.Iced.Widget protocol.
Sets whether the checkbox is disabled.
Sets the label font.
Sets a custom icon for the check mark.
Sets the label line height.
Creates a new checkbox struct with the given label, toggle state, and optional keyword opts.
Sets the checkbox size in pixels.
Sets the spacing between checkbox and label.
Sets the checkbox style.
Sets the text shaping strategy.
Sets the label text size in pixels.
Sets the checkbox width.
Applies keyword options to an existing checkbox struct.
Sets the text wrapping mode.
Types
@type option() :: {: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()} | {:style, style()} | {:icon, map()} | {:disabled, boolean()} | {:a11y, Toddy.Iced.A11y.t()}
@type preset() :: :danger | :success | :secondary | :primary
@type style() :: preset() | Toddy.Iced.StyleMap.t()
@type t() :: %Toddy.Iced.Widget.Checkbox{ a11y: Toddy.Iced.A11y.t() | nil, disabled: boolean() | nil, font: Toddy.Iced.Font.t() | nil, icon: map() | nil, id: String.t(), is_toggled: boolean(), label: String.t(), line_height: number() | map() | nil, size: number() | nil, spacing: number() | nil, style: style() | 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(checkbox :: t(), a11y :: Toddy.Iced.A11y.t()) :: t()
Sets accessibility annotations.
@spec build(checkbox :: t()) :: Toddy.Iced.ui_node()
Converts this checkbox struct to a ui_node() map via the Toddy.Iced.Widget protocol.
Sets whether the checkbox is disabled.
@spec font(checkbox :: t(), font :: Toddy.Iced.Font.t()) :: t()
Sets the label font.
Sets a custom icon for the check mark.
Sets the label line height.
@spec new( id :: String.t(), label :: String.t(), is_toggled :: boolean(), opts :: [option()] ) :: t()
Creates a new checkbox struct with the given label, toggle state, and optional keyword opts.
Sets the checkbox size in pixels.
Sets the spacing between checkbox and label.
Sets the checkbox style.
@spec text_shaping(checkbox :: t(), text_shaping :: Toddy.Iced.Shaping.t()) :: t()
Sets the text shaping strategy.
Sets the label text size in pixels.
@spec width(checkbox :: t(), width :: Toddy.Iced.Length.t()) :: t()
Sets the checkbox width.
Applies keyword options to an existing checkbox struct.
@spec wrapping(checkbox :: t(), wrapping :: Toddy.Iced.Wrapping.t()) :: t()
Sets the text wrapping mode.