# `Plushie.Type.Padding`
[🔗](https://github.com/plushie-ui/plushie-elixir/blob/v0.6.0/lib/plushie/type/padding.ex#L1)

Padding specification with per-side values.

Maps to iced's `Padding` struct. Accepts a uniform number,
a `{vertical, horizontal}` tuple, an explicit four-side map,
or a `%Padding{}` struct with per-side overrides.

`cast/1` always normalises to the full four-side map.

## Struct form

The struct supports per-side padding via keyword construction:

    Padding.from_opts(top: 4, bottom: 8)

`nil` fields are stripped during encoding.

# `t`

```elixir
@type t() ::
  number()
  | {number(), number()}
  | %Plushie.Type.Padding{
      bottom: number() | nil,
      left: number() | nil,
      right: number() | nil,
      top: number() | nil
    }
```

# `cast`

```elixir
@spec cast(padding :: t()) :: map()
```

Normalises a padding value to the canonical four-side map with atom keys.

## Examples

    iex> Plushie.Type.Padding.cast(8)
    %{top: 8, right: 8, bottom: 8, left: 8}

    iex> Plushie.Type.Padding.cast({4, 12})
    %{top: 4, right: 12, bottom: 4, left: 12}

    iex> Plushie.Type.Padding.cast(%{top: 1, right: 2, bottom: 3, left: 4})
    %{top: 1, right: 2, bottom: 3, left: 4}

# `from_opts`

```elixir
@spec from_opts(Keyword.t()) :: %Plushie.Type.Padding{
  bottom: term(),
  left: term(),
  right: term(),
  top: term()
}
```

Constructs padding from a keyword list.

Raises `ArgumentError` if any key is not a valid padding field.

---

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