# `Toddy.Iced.Widget.Rule`
[🔗](https://github.com/toddy-ui/toddy-elixir/blob/v0.3.0/lib/toddy/iced/widget/rule.ex#L1)

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`.

# `option`

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

# `preset`

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

# `style`

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

# `t`

```elixir
@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
}
```

# `a11y`

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

Sets accessibility annotations.

# `build`

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

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

# `direction`

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

Sets the rule direction.

# `height`

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

Sets the rule height (thickness for horizontal rules).

# `new`

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

Creates a new rule struct with optional keyword opts.

# `style`

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

Sets the rule style.

# `width`

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

Sets the rule width (thickness for vertical rules).

# `with_options`

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

Applies keyword options to an existing rule struct.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
