Sensor -- detects visibility and size changes on child content.
Props
delay(non_neg_integer) -- delay in milliseconds before emitting events.anticipate(number) -- distance in pixels to anticipate visibility (triggers events before the widget is fully in view).a11y(map) -- accessibility overrides. SeeToddy.Iced.A11y.
Events
%Sensor{type: :resize, id: id, width: w, height: h}-- emitted on resize.%Sensor{type: :resize, id: "id:show", width: w, height: h}-- emitted when child becomes visible.%Widget{type: :click, id: "id:hide"}-- emitted when child becomes hidden.
Summary
Functions
Sets accessibility annotations.
Sets the anticipation distance in pixels.
Converts this sensor struct to a ui_node() map via the Toddy.Iced.Widget protocol.
Sets the sensor delay in milliseconds.
Appends multiple children to the sensor.
Creates a new sensor struct with optional keyword opts.
Appends a child to the sensor.
Applies keyword options to an existing sensor struct.
Types
@type option() :: {:delay, non_neg_integer()} | {:anticipate, number()} | {:a11y, Toddy.Iced.A11y.t()}
@type t() :: %Toddy.Iced.Widget.Sensor{ a11y: Toddy.Iced.A11y.t() | nil, anticipate: number() | nil, children: [Toddy.Iced.ui_node() | struct()], delay: non_neg_integer() | nil, id: String.t() }
Functions
@spec a11y(sensor :: t(), a11y :: Toddy.Iced.A11y.t()) :: t()
Sets accessibility annotations.
Sets the anticipation distance in pixels.
@spec build(sensor :: t()) :: Toddy.Iced.ui_node()
Converts this sensor struct to a ui_node() map via the Toddy.Iced.Widget protocol.
@spec delay(sensor :: t(), delay :: non_neg_integer()) :: t()
Sets the sensor delay in milliseconds.
@spec extend(sensor :: t(), children :: [Toddy.Iced.ui_node() | struct()]) :: t()
Appends multiple children to the sensor.
Creates a new sensor struct with optional keyword opts.
@spec push(sensor :: t(), child :: Toddy.Iced.ui_node() | struct()) :: t()
Appends a child to the sensor.
Applies keyword options to an existing sensor struct.