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

Border specification for container and widget styling.

A border has three properties:

  * `color` - hex color string (e.g. `"#ff0000"`). `nil` means no color override.
  * `width` - border width in pixels. Default: `0`.
  * `radius` - corner radius. Either a uniform number or a per-corner
    `radius_map()` from `radius/4`. Default: `0`.

## Wire format

The encoded border is a map:

    %{color: "#ff0000", width: 2, radius: 8}

Radius can be a uniform number or a per-corner map:

    %{top_left: 8, top_right: 8, bottom_right: 0, bottom_left: 0}

## Example

    border = Plushie.Type.Border.new()
             |> Plushie.Type.Border.color("#3366ff")
             |> Plushie.Type.Border.width(2)
             |> Plushie.Type.Border.rounded(8)

# `radius_map`

```elixir
@type radius_map() :: %{
  top_left: number(),
  top_right: number(),
  bottom_right: number(),
  bottom_left: number()
}
```

Per-corner radius map.

# `t`

```elixir
@type t() :: %Plushie.Type.Border{
  color: Plushie.Type.Color.t() | nil,
  radius: number() | radius_map(),
  width: number()
}
```

Border specification with color, width, and radius.

# `color`

```elixir
@spec color(border :: t(), color :: Plushie.Type.Color.input()) :: t()
```

Sets the border color. Accepts a hex string or named color atom.

# `encode`

```elixir
@spec encode(border :: t()) :: map()
```

Encodes a border to the wire format.

# `from_opts`

```elixir
@spec from_opts(opts :: keyword()) :: t()
```

Constructs a `Border` from a keyword list.

# `new`

```elixir
@spec new() :: t()
```

Creates a new border with default values (no color, zero width, zero radius).

# `radius`

```elixir
@spec radius(
  top_left :: number(),
  top_right :: number(),
  bottom_right :: number(),
  bottom_left :: number()
) :: radius_map()
```

Creates a per-corner radius map.

# `rounded`

```elixir
@spec rounded(border :: t(), radius :: number()) :: t()
```

Sets a uniform corner radius in pixels.

# `width`

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

Sets the border width in pixels.

---

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