Plushie.Widget.Floating (Plushie v0.6.0)

Copy Markdown View Source

Floating overlay -- positions child with optional translation and scaling.

Props

  • translate_x (number) -- horizontal translation in pixels. Default: 0.
  • translate_y (number) -- vertical translation in pixels. Default: 0.
  • scale (number) -- scale factor for the child content.
  • width (length) -- float width. See Plushie.Type.Length.
  • height (length) -- float height. See Plushie.Type.Length.
  • a11y (map) -- accessibility overrides. See Plushie.Type.A11y.

Summary

Functions

Sets accessibility annotations.

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

Appends multiple children to the float.

Sets the float height.

Creates a new float struct with optional keyword opts.

Appends a child to the float.

Sets the scale factor.

Sets the horizontal translation in pixels.

Sets the vertical translation in pixels.

Sets the float width.

Applies keyword options to an existing float struct.

Types

option()

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

t()

@type t() :: %Plushie.Widget.Floating{
  a11y: Plushie.Type.A11y.t() | nil,
  children: [Plushie.Widget.child()],
  height: Plushie.Type.Length.t() | nil,
  id: String.t(),
  scale: number() | nil,
  translate_x: number() | nil,
  translate_y: number() | nil,
  width: Plushie.Type.Length.t() | nil
}

Functions

a11y(fw, a11y)

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

Sets accessibility annotations.

build(fw)

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

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

extend(fw, children)

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

Appends multiple children to the float.

height(fw, height)

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

Sets the float height.

new(id, opts \\ [])

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

Creates a new float struct with optional keyword opts.

push(fw, child)

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

Appends a child to the float.

scale(fw, v)

@spec scale(floating :: t(), scale :: number()) :: t()

Sets the scale factor.

translate_x(fw, v)

@spec translate_x(floating :: t(), translate_x :: number()) :: t()

Sets the horizontal translation in pixels.

translate_y(fw, v)

@spec translate_y(floating :: t(), translate_y :: number()) :: t()

Sets the vertical translation in pixels.

width(fw, width)

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

Sets the float width.

with_options(fw, opts)

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

Applies keyword options to an existing float struct.