Toddy.Iced.Widget.Rule (Toddy v0.3.0)

Copy Markdown View Source

Horizontal or vertical rule (divider line).

Props

  • height (number) -- line thickness in pixels (for horizontal rules). Default: 1.
  • width (number) -- line thickness in pixels (for vertical rules). Also accepts thickness.
  • direction -- :horizontal (default) or :vertical. See Toddy.Iced.Direction.
  • style -- named preset atom (:default, :weak) or StyleMap.t() for custom styling. See Toddy.Iced.StyleMap.
  • a11y (map) -- accessibility overrides. See Toddy.Iced.A11y.

Summary

Functions

Sets accessibility annotations.

Converts this rule struct to a ui_node() map via the Toddy.Iced.Widget protocol.

Sets the rule direction.

Sets the rule height (thickness for horizontal rules).

Creates a new rule struct with optional keyword opts.

Sets the rule style.

Sets the rule width (thickness for vertical rules).

Applies keyword options to an existing rule struct.

Types

option()

@type option() ::
  {:height, number()}
  | {:width, number()}
  | {:direction, Toddy.Iced.Direction.t()}
  | {:style, style()}
  | {:a11y, Toddy.Iced.A11y.t()}

preset()

@type preset() :: :weak | :default

style()

@type style() :: preset() | Toddy.Iced.StyleMap.t()

t()

@type t() :: %Toddy.Iced.Widget.Rule{
  a11y: Toddy.Iced.A11y.t() | nil,
  direction: Toddy.Iced.Direction.t() | nil,
  height: number() | nil,
  id: String.t(),
  style: style() | nil,
  width: number() | nil
}

Functions

a11y(rule, a11y)

@spec a11y(rule :: t(), a11y :: Toddy.Iced.A11y.t()) :: t()

Sets accessibility annotations.

build(rule)

@spec build(rule :: t()) :: Toddy.Iced.ui_node()

Converts this rule struct to a ui_node() map via the Toddy.Iced.Widget protocol.

direction(rule, direction)

@spec direction(rule :: t(), direction :: Toddy.Iced.Direction.t()) :: t()

Sets the rule direction.

height(rule, height)

@spec height(rule :: t(), height :: number()) :: t()

Sets the rule height (thickness for horizontal rules).

new(id, opts \\ [])

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

Creates a new rule struct with optional keyword opts.

style(rule, style)

@spec style(rule :: t(), style :: style()) :: t()

Sets the rule style.

width(rule, width)

@spec width(rule :: t(), width :: number()) :: t()

Sets the rule width (thickness for vertical rules).

with_options(rule, opts)

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

Applies keyword options to an existing rule struct.