# `PhiaUiDesign.Templates.PageTemplates`
[🔗](https://github.com/charlenopires/PhiaUI/blob/v0.1.17/lib/phiaui_design/templates/page_templates.ex#L1)

Pre-built page scaffolds for the PhiaUI Design editor.

Each template function builds a set of nodes in a Scene, creating
a ready-to-customize page layout with real PhiaUI components.

Templates return `{:ok, scene}` on success, or `{:error, reason}` on failure.
Node IDs are generated automatically so templates can be applied multiple times
to different scenes without collision.

## Usage

    scene = Scene.new()
    {:ok, scene} = PageTemplates.apply_template(scene, :dashboard)

## Available templates

    PageTemplates.list()
    # => [%{key: :dashboard, name: "Dashboard", ...}, ...]

# `apply_template`

```elixir
@spec apply_template(PhiaUiDesign.Canvas.Scene.scene_id(), atom()) ::
  {:ok, PhiaUiDesign.Canvas.Scene.scene_id()} | {:error, atom()}
```

Apply a page template to a scene.

Inserts the template's nodes into the given scene and returns
`{:ok, scene}`. The scene is mutated in place (ETS), so the
returned reference is the same as the input.

Returns `{:error, :unknown_template}` if the key is not recognized.

# `get`

```elixir
@spec get(atom()) :: map() | nil
```

Get a single template's metadata by key.

# `keys`

```elixir
@spec keys() :: [atom()]
```

Return the list of valid template keys.

# `list`

```elixir
@spec list() :: [map()]
```

List all available page templates with metadata.

Returns a list of maps with `:key`, `:name`, `:description`, and `:category`.

# `list_by_category`

```elixir
@spec list_by_category(atom()) :: [map()]
```

List templates filtered by category.

Categories: `:app`, `:auth`, `:marketing`, `:utility`.

---

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