Plushie.Widget.KeyedColumn (Plushie v0.6.0)

Copy Markdown View Source

Keyed column layout -- arranges children vertically with stable identity keys.

Like Column, but uses each child's id as a key for iced's internal widget diffing. This avoids unnecessary rebuilds when items are added, removed, or reordered in dynamic lists.

Props

  • spacing (number) -- vertical space between children in pixels. Default: 0.
  • padding (number | map) -- padding inside the column. See Plushie.Type.Padding.

  • width (length) -- column width. Default: shrink. See Plushie.Type.Length.
  • height (length) -- column height. Default: shrink.
  • max_width (number) -- maximum width in pixels.
  • a11y (map) -- accessibility overrides. See Plushie.Type.A11y.

Summary

Functions

Sets accessibility annotations.

Converts this keyed column struct to a ui_node() map via the Plushie.Widget protocol.

Appends multiple children to the keyed column.

Sets the column height.

Sets the maximum width in pixels.

Creates a new keyed column struct with optional keyword opts.

Sets the padding inside the column.

Appends a child to the keyed column.

Sets the spacing between children in pixels.

Sets the column width.

Applies keyword options to an existing keyed column struct.

Types

option()

@type option() ::
  {:spacing, number()}
  | {:padding, Plushie.Type.Padding.t()}
  | {:width, Plushie.Type.Length.t()}
  | {:height, Plushie.Type.Length.t()}
  | {:max_width, number()}
  | {:a11y, Plushie.Type.A11y.t() | map() | keyword()}

t()

@type t() :: %Plushie.Widget.KeyedColumn{
  a11y: Plushie.Type.A11y.t() | nil,
  children: [Plushie.Widget.child()],
  height: Plushie.Type.Length.t() | nil,
  id: String.t(),
  max_width: number() | nil,
  padding: Plushie.Type.Padding.t() | nil,
  spacing: number() | nil,
  width: Plushie.Type.Length.t() | nil
}

Functions

a11y(kc, a11y)

@spec a11y(keyed_column :: t(), a11y :: Plushie.Type.A11y.t() | map() | keyword()) ::
  t()

Sets accessibility annotations.

build(kc)

@spec build(keyed_column :: t()) :: Plushie.Widget.ui_node()

Converts this keyed column struct to a ui_node() map via the Plushie.Widget protocol.

extend(kc, children)

@spec extend(
  keyed_column :: t(),
  children :: [Plushie.Widget.child()]
) :: t()

Appends multiple children to the keyed column.

height(kc, height)

@spec height(keyed_column :: t(), height :: Plushie.Type.Length.t()) :: t()

Sets the column height.

max_width(kc, max_width)

@spec max_width(keyed_column :: t(), max_width :: number()) :: t()

Sets the maximum width in pixels.

new(id, opts \\ [])

@spec new(id :: String.t(), opts :: [option()]) :: t()

Creates a new keyed column struct with optional keyword opts.

padding(kc, padding)

@spec padding(keyed_column :: t(), padding :: Plushie.Type.Padding.t()) :: t()

Sets the padding inside the column.

push(kc, child)

@spec push(keyed_column :: t(), child :: Plushie.Widget.child()) :: t()

Appends a child to the keyed column.

spacing(kc, spacing)

@spec spacing(keyed_column :: t(), spacing :: number()) :: t()

Sets the spacing between children in pixels.

width(kc, width)

@spec width(keyed_column :: t(), width :: Plushie.Type.Length.t()) :: t()

Sets the column width.

with_options(kc, opts)

@spec with_options(keyed_column :: t(), opts :: [option()]) :: t()

Applies keyword options to an existing keyed column struct.