Responsive layout -- adapts to available size by reporting resize events.
The renderer wraps child content in a sensor that sends
%WidgetEvent{type: :resize, id: id, data: %{width: w, height: h}} events so the
Elixir app can adjust its view based on the measured size.
Props
width(length) -- container width. Default: fill. SeePlushie.Type.Length.height(length) -- container height. Default: fill.a11y(map) -- accessibility overrides. SeePlushie.Type.A11y.
Summary
Functions
Sets accessibility annotations.
Converts this responsive struct to a ui_node() map via the Plushie.Widget protocol.
Appends multiple children to the responsive container.
Sets the container height.
Creates a new responsive struct with optional keyword opts.
Appends a child to the responsive container.
Sets the container width.
Applies keyword options to an existing responsive struct.
Types
@type option() :: {:width, Plushie.Type.Length.t()} | {:height, Plushie.Type.Length.t()} | {:a11y, Plushie.Type.A11y.t() | map() | keyword()}
@type t() :: %Plushie.Widget.Responsive{ a11y: Plushie.Type.A11y.t() | nil, children: [Plushie.Widget.child()], height: Plushie.Type.Length.t() | nil, id: String.t(), width: Plushie.Type.Length.t() | nil }
Functions
@spec a11y(responsive :: t(), a11y :: Plushie.Type.A11y.t() | map() | keyword()) :: t()
Sets accessibility annotations.
@spec build(responsive :: t()) :: Plushie.Widget.ui_node()
Converts this responsive struct to a ui_node() map via the Plushie.Widget protocol.
@spec extend( responsive :: t(), children :: [Plushie.Widget.child()] ) :: t()
Appends multiple children to the responsive container.
@spec height(responsive :: t(), height :: Plushie.Type.Length.t()) :: t()
Sets the container height.
Creates a new responsive struct with optional keyword opts.
@spec push(responsive :: t(), child :: Plushie.Widget.child()) :: t()
Appends a child to the responsive container.
@spec width(responsive :: t(), width :: Plushie.Type.Length.t()) :: t()
Sets the container width.
Applies keyword options to an existing responsive struct.