Radio button -- one-of-many selection.
All radios in a group should share the same group prop value. The
selected prop should be set to the currently selected value across
all radios in the group.
Props
value(string) -- the value this radio represents.selected(string) -- the currently selected value in the group.label(string) -- label text. Defaults tovalueif omitted.group(string) -- group identifier. All radios with the same group emit events with the group name as the event ID.spacing(number) -- space between radio and label in pixels.width(length) -- widget width. Default: shrink. SeeToddy.Iced.Length.size(number) -- radio button 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--:defaultorStyleMap.t()for custom styling. SeeToddy.Iced.StyleMap.a11y(map) -- accessibility overrides. SeeToddy.Iced.A11y.
Events
%Widget{type: :select, id: group_or_id, value: value}-- emitted when this radio is selected. Theidis thegroupprop if set, otherwise the node ID.
Summary
Functions
Sets accessibility annotations.
Converts this radio struct to a ui_node() map via the Toddy.Iced.Widget protocol.
Sets the label font.
Sets the radio group identifier.
Sets the radio label text.
Sets the label line height.
Creates a new radio struct with the given value, selected state, and optional keyword opts.
Sets the radio button size in pixels.
Sets the spacing between radio and label.
Sets the radio style.
Sets the text shaping strategy.
Sets the label text size in pixels.
Sets the radio width.
Applies keyword options to an existing radio struct.
Sets the text wrapping mode.
Types
@type option() :: {:label, String.t()} | {:group, 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()} | {:style, style()} | {:a11y, Toddy.Iced.A11y.t()}
@type style() :: :default | Toddy.Iced.StyleMap.t()
@type t() :: %Toddy.Iced.Widget.Radio{ a11y: Toddy.Iced.A11y.t() | nil, font: Toddy.Iced.Font.t() | nil, group: String.t() | nil, id: String.t(), label: String.t() | nil, line_height: number() | map() | nil, selected: String.t(), size: number() | nil, spacing: number() | nil, style: style() | nil, text_shaping: Toddy.Iced.Shaping.t() | nil, text_size: number() | nil, value: String.t(), width: Toddy.Iced.Length.t() | nil, wrapping: Toddy.Iced.Wrapping.t() | nil }
Functions
@spec a11y(radio :: t(), a11y :: Toddy.Iced.A11y.t()) :: t()
Sets accessibility annotations.
@spec build(radio :: t()) :: Toddy.Iced.ui_node()
Converts this radio struct to a ui_node() map via the Toddy.Iced.Widget protocol.
@spec font(radio :: t(), font :: Toddy.Iced.Font.t()) :: t()
Sets the label font.
Sets the radio group identifier.
Sets the radio label text.
Sets the label line height.
@spec new( id :: String.t(), value :: String.t(), selected :: String.t(), opts :: [option()] ) :: t()
Creates a new radio struct with the given value, selected state, and optional keyword opts.
Sets the radio button size in pixels.
Sets the spacing between radio and label.
Sets the radio style.
@spec text_shaping(radio :: t(), text_shaping :: Toddy.Iced.Shaping.t()) :: t()
Sets the text shaping strategy.
Sets the label text size in pixels.
@spec width(radio :: t(), width :: Toddy.Iced.Length.t()) :: t()
Sets the radio width.
Applies keyword options to an existing radio struct.
@spec wrapping(radio :: t(), wrapping :: Toddy.Iced.Wrapping.t()) :: t()
Sets the text wrapping mode.