# `Mob.Style`
[🔗](https://github.com/genericjam/mob/blob/master/lib/mob/style.ex#L1)

Thin wrapper around a props map for named, reusable styles.

The struct type lets the `~MOB` sigil (and future tooling) distinguish a
style value from a plain data map. At serialisation time `Mob.Renderer`
merges a style's props into the node's own props — there is no runtime
overhead.

## Defining styles

    # As a module attribute — compiled to a constant
    @header  %Mob.Style{props: %{text_size: :xl, text_color: :white, background: :primary, padding: 16}}
    @btn     %Mob.Style{props: %{text_size: :lg, text_color: :white, padding: 12}}
    @btn_primary  Mob.Style.put(@btn, :background, :blue_700)
    @btn_danger   Mob.Style.put(@btn, :background, :red_500)

## Using styles in a node

    %{
      type: :text,
      props: %{style: @header, text: "Title"},
      children: []
    }

Inline props override style values, so:

    %{
      type: :text,
      props: %{style: @header, text_size: :base},   # overrides :xl from @header
      children: []
    }

Token values (`:primary`, `:xl`, `:white`, etc.) are resolved by
`Mob.Renderer` before JSON serialisation — the native side always
receives plain integers and floats.

# `t`

```elixir
@type t() :: %Mob.Style{props: map()}
```

# `merge`

```elixir
@spec merge(t(), t()) :: t()
```

Merge two styles; keys in `b` win over keys in `a`.

# `put`

```elixir
@spec put(t(), atom(), term()) :: t()
```

Return a copy of `style` with `key` set to `value`.

---

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