Grid layout -- arranges children in a fixed-column grid.
Props
columns(integer) -- number of columns. Default: 1.spacing(number) -- spacing between grid cells in pixels. Default: 0.width(number) -- grid width in pixels.height(number) -- grid height in pixels.column_width(Length) -- width of each column. Accepts:fill,:shrink,{:fill_portion, n}, or a fixed pixel number.row_height(Length) -- height of each row. Accepts:fill,:shrink,{:fill_portion, n}, or a fixed pixel number.fluid(number) -- enables fluid grid mode. The value is the max cell width in pixels; columns auto-wrap to fit the available width.a11y(map) -- accessibility overrides. SeePlushie.Type.A11y.
Summary
Functions
Sets accessibility annotations.
Converts this grid struct to a ui_node() map via the Plushie.Widget protocol.
Sets the column width using a Length value (fill/shrink/fixed/fill_portion).
Sets the number of columns.
Appends multiple children to the grid.
Enables fluid grid mode. The value is the max cell width in pixels; columns auto-wrap.
Sets the grid height in pixels.
Creates a new grid struct with optional keyword opts.
Appends a child to the grid.
Sets the row height using a Length value (fill/shrink/fixed/fill_portion).
Sets the spacing between grid cells in pixels.
Sets the grid width in pixels.
Applies keyword options to an existing grid struct.
Types
@type option() :: {:columns, pos_integer()} | {:spacing, number()} | {:width, number()} | {:height, number()} | {:column_width, Plushie.Type.Length.t()} | {:row_height, Plushie.Type.Length.t()} | {:fluid, number()} | {:a11y, Plushie.Type.A11y.t() | map() | keyword()}
@type t() :: %Plushie.Widget.Grid{ a11y: Plushie.Type.A11y.t() | nil, children: [Plushie.Widget.child()], column_width: Plushie.Type.Length.t() | nil, columns: pos_integer() | nil, fluid: number() | nil, height: number() | nil, id: String.t(), row_height: Plushie.Type.Length.t() | nil, spacing: number() | nil, width: number() | nil }
Functions
@spec a11y(grid :: t(), a11y :: Plushie.Type.A11y.t() | map() | keyword()) :: t()
Sets accessibility annotations.
@spec build(grid :: t()) :: Plushie.Widget.ui_node()
Converts this grid struct to a ui_node() map via the Plushie.Widget protocol.
@spec column_width(grid :: t(), column_width :: Plushie.Type.Length.t()) :: t()
Sets the column width using a Length value (fill/shrink/fixed/fill_portion).
@spec columns(grid :: t(), columns :: pos_integer()) :: t()
Sets the number of columns.
@spec extend(grid :: t(), children :: [Plushie.Widget.child()]) :: t()
Appends multiple children to the grid.
Enables fluid grid mode. The value is the max cell width in pixels; columns auto-wrap.
Sets the grid height in pixels.
Creates a new grid struct with optional keyword opts.
@spec push(grid :: t(), child :: Plushie.Widget.child()) :: t()
Appends a child to the grid.
@spec row_height(grid :: t(), row_height :: Plushie.Type.Length.t()) :: t()
Sets the row height using a Length value (fill/shrink/fixed/fill_portion).
Sets the spacing between grid cells in pixels.
Sets the grid width in pixels.
Applies keyword options to an existing grid struct.