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

Text display -- renders static text.

## Props

- `content` (string) -- the text string to display.
- `size` (number) -- font size in pixels.
- `color` (color) -- text color. See `Toddy.Iced.Color`.
- `font` (string | map) -- font specification. See `Toddy.Iced.Font`.
- `width` (length) -- text widget width. See `Toddy.Iced.Length`.
- `height` (length) -- text widget height.
- `line_height` (number | map) -- line height. Number is a relative multiplier;
  map with `%{relative: n}` or `%{absolute: n}` for explicit control.
- `align_x` (atom) -- horizontal text alignment: `:left`, `:center`, `:right`.
  See `Toddy.Iced.Alignment`.
- `align_y` (atom) -- vertical text alignment: `:top`, `:center`, `:bottom`.
  See `Toddy.Iced.Alignment`.
- `wrapping` (atom) -- text wrapping: `:none`, `:word`, `:glyph`, `:word_or_glyph`.
  See `Toddy.Iced.Wrapping`.
- `ellipsis` (string) -- text ellipsis mode: `"none"`, `"start"`, `"middle"`, `"end"`.
  Truncates text that overflows and inserts an ellipsis character at the given position.
- `style` (atom) -- named style. One of: `:default`, `:primary`, `:secondary`,
  `:success`, `:danger`, `:warning`.
- `shaping` (atom) -- text shaping strategy: `:basic` or `:advanced`.
  See `Toddy.Iced.Shaping`.
- `a11y` (map) -- accessibility overrides. See `Toddy.Iced.A11y`.

# `option`

```elixir
@type option() ::
  {:size, number()}
  | {:color, Toddy.Iced.Color.input()}
  | {:font, Toddy.Iced.Font.t()}
  | {:width, Toddy.Iced.Length.t()}
  | {:height, Toddy.Iced.Length.t()}
  | {:line_height, number() | map()}
  | {:align_x, Toddy.Iced.Alignment.t()}
  | {:align_y, Toddy.Iced.Alignment.t()}
  | {:wrapping, Toddy.Iced.Wrapping.t()}
  | {:ellipsis, String.t()}
  | {:shaping, Toddy.Iced.Shaping.t()}
  | {:style, style()}
  | {:a11y, Toddy.Iced.A11y.t()}
```

# `preset`

```elixir
@type preset() :: :warning | :danger | :success | :secondary | :primary | :default
```

# `style`

```elixir
@type style() :: preset()
```

# `t`

```elixir
@type t() :: %Toddy.Iced.Widget.Text{
  a11y: Toddy.Iced.A11y.t() | nil,
  align_x: Toddy.Iced.Alignment.t() | nil,
  align_y: Toddy.Iced.Alignment.t() | nil,
  color: Toddy.Iced.Color.t() | nil,
  content: String.t(),
  ellipsis: String.t() | nil,
  font: Toddy.Iced.Font.t() | nil,
  height: Toddy.Iced.Length.t() | nil,
  id: String.t(),
  line_height: number() | map() | nil,
  shaping: Toddy.Iced.Shaping.t() | nil,
  size: number() | nil,
  style: style() | nil,
  width: Toddy.Iced.Length.t() | nil,
  wrapping: Toddy.Iced.Wrapping.t() | nil
}
```

# `a11y`

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

Sets accessibility annotations.

# `align_x`

```elixir
@spec align_x(text :: t(), align_x :: Toddy.Iced.Alignment.t()) :: t()
```

Sets the horizontal text alignment.

# `align_y`

```elixir
@spec align_y(text :: t(), align_y :: Toddy.Iced.Alignment.t()) :: t()
```

Sets the vertical text alignment.

# `build`

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

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

# `color`

```elixir
@spec color(text :: t(), color :: Toddy.Iced.Color.input()) :: t()
```

Sets the text color.

# `ellipsis`

```elixir
@spec ellipsis(text :: t(), ellipsis :: String.t()) :: t()
```

Sets the text ellipsis mode. One of: `"none"`, `"start"`, `"middle"`, `"end"`.

# `font`

```elixir
@spec font(text :: t(), font :: Toddy.Iced.Font.t()) :: t()
```

Sets the font.

# `height`

```elixir
@spec height(text :: t(), height :: Toddy.Iced.Length.t()) :: t()
```

Sets the text widget height.

# `line_height`

```elixir
@spec line_height(text :: t(), line_height :: number() | map()) :: t()
```

Sets the line height.

# `new`

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

Creates a new text widget struct with the given content and optional keyword opts.

# `shaping`

```elixir
@spec shaping(text :: t(), shaping :: Toddy.Iced.Shaping.t()) :: t()
```

Sets the text shaping strategy.

# `size`

```elixir
@spec size(text :: t(), size :: number()) :: t()
```

Sets the font size in pixels.

# `style`

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

Sets the text style.

# `width`

```elixir
@spec width(text :: t(), width :: Toddy.Iced.Length.t()) :: t()
```

Sets the text widget width.

# `with_options`

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

Applies keyword options to an existing text struct.

# `wrapping`

```elixir
@spec wrapping(text :: t(), wrapping :: Toddy.Iced.Wrapping.t()) :: t()
```

Sets the text wrapping mode.

---

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