Overlay container -- positions the second child as a floating overlay relative to the first child (anchor).
Props
position(atom) -- overlay position relative to anchor::below,:above,:left,:right. Default::below.gap(number) -- space in pixels between anchor and overlay. Default: 0.offset_x(number) -- horizontal offset in pixels applied after positioning.offset_y(number) -- vertical offset in pixels applied after positioning.width(length) -- width of the overlay node. SeeToddy.Iced.Length.a11y(map) -- accessibility overrides. SeeToddy.Iced.A11y.
Children
Exactly two children are expected:
- The anchor widget (rendered inline in the layout).
- The overlay content (rendered as a floating overlay above everything else).
Summary
Functions
Sets accessibility annotations.
Converts this overlay struct to a ui_node() map via the Toddy.Iced.Widget protocol.
Appends multiple children to the overlay.
Sets the gap between anchor and overlay in pixels.
Creates a new overlay struct with optional keyword opts.
Sets the horizontal offset in pixels.
Sets the vertical offset in pixels.
Sets the overlay position relative to the anchor.
Appends a child to the overlay.
Sets the width of the overlay node.
Applies keyword options to an existing overlay struct.
Types
@type option() :: {:position, position()} | {:gap, number()} | {:offset_x, number()} | {:offset_y, number()} | {:width, Toddy.Iced.Length.t()} | {:a11y, Toddy.Iced.A11y.t()}
@type position() :: :right | :left | :above | :below
@type t() :: %Toddy.Iced.Widget.Overlay{ a11y: Toddy.Iced.A11y.t() | nil, children: [Toddy.Iced.ui_node() | struct()], gap: number() | nil, id: String.t(), offset_x: number() | nil, offset_y: number() | nil, position: position() | nil, width: Toddy.Iced.Length.t() | nil }
Functions
@spec a11y(overlay :: t(), a11y :: Toddy.Iced.A11y.t()) :: t()
Sets accessibility annotations.
@spec build(overlay :: t()) :: Toddy.Iced.ui_node()
Converts this overlay struct to a ui_node() map via the Toddy.Iced.Widget protocol.
@spec extend(overlay :: t(), children :: [Toddy.Iced.ui_node() | struct()]) :: t()
Appends multiple children to the overlay.
Sets the gap between anchor and overlay in pixels.
Creates a new overlay struct with optional keyword opts.
Sets the horizontal offset in pixels.
Sets the vertical offset in pixels.
Sets the overlay position relative to the anchor.
@spec push(overlay :: t(), child :: Toddy.Iced.ui_node() | struct()) :: t()
Appends a child to the overlay.
@spec width(overlay :: t(), width :: Toddy.Iced.Length.t()) :: t()
Sets the width of the overlay node.
Applies keyword options to an existing overlay struct.