---
title: 'Overview'
description: 'What an example is: a tested example you copy into an app, with the files it runs, the install line it needs and a live demo where it renders UI.'
order: 0
---

# Examples

An example is one use case, written as files you can copy into an app and run. Each example page shows every file word for word, and a test runs the same files, so a snippet cannot drift from the code that works. The one exception is a helper, a file named `<name>.helper.ts` that holds only what a demo run needs, such as fake services or a stand-in network. The page names it where an import points at it and does not show it: the files that carry the lesson run with your own services in its place. A React forms example has one more import it does not show, `@/components/schema-engine/forms/registrations`, the barrel that installing the shadcn registry leaves in an app, so its files show the form and not the fields.

## What an example holds

- **The files.** Each is a module that imports only packages and its sibling files (`./config`). The one other import is the installed fields of a React forms example, which your app has once you run the command below, so it runs where you paste it.
- **The page.** It states the install line, then shows every file under its name. An example that renders UI has a live demo, and a forms example shows its React and Radiant files in tabs side by side.
- **The test.** It runs the files, including the failure paths, in a unit or browser test. An example that is not tested, or whose page differs from its files, fails a test.

## Copy an example

1. Run the install line at the top of the example's page.
2. Create one folder and copy every file of the page into it under the name above the code. The files import each other as `./name`, so they keep working side by side.
3. Run the entry the page names, or render the component it exports.

## Examples by domain

Examples by domain, with what each shows and the install line it needs.

### Registry

| Example                                                              | Shows                                                                                                 | Install                                                |
| -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
| [Render a server-sent document](/docs/examples/server-sent-document) | A route handler and a React component that draws what it knows and shows the issues of what it cannot | `pnpm add @schema-engine/registry react react-dom zod` |

### Actions

| Example                                                 | Shows                                                                             | Install                                                       |
| ------------------------------------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| [A checkout workflow](/docs/examples/checkout-workflow) | A JSON workflow with a parallel group, and a declined card that cancels the group | `pnpm add @schema-engine/actions @schema-engine/registry zod` |

### Forms

Each forms example has React and Radiant tabs and these two install lines, one for each renderer:

- React: `pnpm add @schema-engine/forms @schema-engine/forms-react @schema-engine/layout react react-dom zod`, then `pnpm dlx shadcn@latest add schema-engine/schema-engine/schema-form` for the fields the files register
- Radiant: `pnpm add @schema-engine/forms @schema-engine/forms-radiant @schema-engine/layout @ecopages/radiant-ui @ecopages/radiant @ecopages/jsx @ecopages/signals zod`

A server-driven form also writes issue paths with `formatIssuePath`, so its lines add `@schema-engine/registry`:

- React: `pnpm add @schema-engine/forms @schema-engine/forms-react @schema-engine/layout @schema-engine/registry react react-dom zod`
- Radiant: `pnpm add @schema-engine/forms @schema-engine/forms-radiant @schema-engine/layout @schema-engine/registry @ecopages/radiant-ui @ecopages/radiant @ecopages/jsx @ecopages/signals zod`

| Example                                                        | Shows                                                                                                           |
| -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| [Contact form](/docs/examples/contact-form)                    | Rules with messages, a field shown only for a support request, a JSON submit and a 422 on its field             |
| [Registration wizard](/docs/examples/registration-wizard)      | Two steps, Next that validates the step it leaves, and a taken email that sends the visitor back                |
| [Branching survey](/docs/examples/branching-survey)            | A step skipped unless the answer was poor, validated on Next and left out of what is sent                       |
| [Submit, notify and reset](/docs/examples/submit-notify-reset) | Actions in the config: send, tell the visitor, clear the form, and report a failure                             |
| [A server-driven form](/docs/examples/server-driven-form)      | A form config fetched from an endpoint and checked, the engine fetch with a CSRF header, and a 422 on its field |

### Layout

| Example                                     | Shows                                                                                                                                                                                            | Install                                                                      |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------- |
| [A layout page](/docs/examples/layout-page) | A page with no form: a theme, drawn areas that change at two breakpoints, items placed by name                                                                                                   | `pnpm add @schema-engine/layout @schema-engine/registry zod react react-dom` |
| [A themed form](/docs/examples/theming)     | Host `tone`, `shape` and `font` axes compiled into a theme shared by every engine, a Shuffle that restyles both renderers, and one stylesheet for rhythm, the compact size hooks and the measure | The two install lines of the forms examples                                  |
