# `PhoenixReplay.Replay`
[🔗](https://github.com/elixir-vibe/phoenix_replay/blob/v0.6.2/lib/phoenix_replay/replay.ex#L1)

How your app's recordings are replayed, as a whole. For how one LiveView
renders in a replay, see `PhoenixReplay.Replay.View`; for assigns that
changed shape since a recording, see `PhoenixReplay.Migration`.

Replays render today's templates and root layout with the assigns
recorded then, and most need nothing more: an assign a recording lacks
is rendered as `nil`, and the root layout, rendered again at each moment,
gives the replayed page's `<html>` and `<body>` their attributes, such
as a theme. A module of this behaviour, configured as `:replay`, covers
a layout whose attributes come from something other than its assigns:

    config :phoenix_replay, replay: MyAppWeb.Replay

    defmodule MyAppWeb.Replay do
      @behaviour PhoenixReplay.Replay

      @impl true
      def root_attributes(_view, assigns), do: %{"data-plan" => assigns[:plan]}
    end

Its callback is optional.

# `root_attributes`
*optional* 

```elixir
@callback root_attributes(view :: module(), assigns :: map()) :: %{
  optional(String.t() | atom()) =&gt; String.t() | nil
}
```

Attributes for the replayed page's `<html>` at a moment, besides those
the root layout renders, for a layout whose attributes come from
something other than its assigns.

# `root_attributes`

```elixir
@spec root_attributes(module() | nil, module(), map()) :: %{
  required(String.t()) =&gt; String.t() | nil
}
```

Calls `module`'s `c:root_attributes/2`, with names and values as
strings, or returns no attributes without it.

---

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