Plushie.Widget.Pin (Plushie v0.6.0)

Copy Markdown View Source

Pin layout -- positions child at absolute coordinates.

Props

  • x (number) -- x position in pixels. Default: 0.
  • y (number) -- y position in pixels. Default: 0.
  • width (length) -- pin container width. Default: shrink. See Plushie.Type.Length.
  • height (length) -- pin container height. Default: shrink.
  • a11y (map) -- accessibility overrides. See Plushie.Type.A11y.

Summary

Functions

Sets accessibility annotations.

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

Appends multiple children to the pin.

Sets the pin container height.

Creates a new pin struct with optional keyword opts.

Appends a child to the pin.

Sets the pin container width.

Applies keyword options to an existing pin struct.

Sets the x position in pixels.

Sets the y position in pixels.

Types

option()

@type option() ::
  {:x, number()}
  | {:y, number()}
  | {:width, Plushie.Type.Length.t()}
  | {:height, Plushie.Type.Length.t()}
  | {:a11y, Plushie.Type.A11y.t() | map() | keyword()}

t()

@type t() :: %Plushie.Widget.Pin{
  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,
  x: number() | nil,
  y: number() | nil
}

Functions

a11y(pin, a11y)

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

Sets accessibility annotations.

build(pin)

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

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

extend(pin, children)

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

Appends multiple children to the pin.

height(pin, height)

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

Sets the pin container height.

new(id, opts \\ [])

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

Creates a new pin struct with optional keyword opts.

push(pin, child)

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

Appends a child to the pin.

width(pin, width)

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

Sets the pin container width.

with_options(pin, opts)

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

Applies keyword options to an existing pin struct.

x(pin, x)

@spec x(pin :: t(), x :: number()) :: t()

Sets the x position in pixels.

y(pin, y)

@spec y(pin :: t(), y :: number()) :: t()

Sets the y position in pixels.