# Composition & Mini-Apps

Components compose. A ChainRender **app** is a composition of components — and compositions are themselves
first-class, content-addressed, forkable objects.

## Composing

You nest components (a box containing a header, tabs, and panels) and reference other registered components by hash.
The composition's capability envelope is the **union** of its parts — you can't escape your components' declared
capabilities by composing them, and you can't under-declare the aggregate. A composition is graded as a whole.

## Multi-view apps

An app can have multiple **views** (tabs, wizard steps, master-detail, modal) with in-app navigation. Each view
renders its own on-chain floor; the shell provides navigation. A reachability invariant ensures no view is
stranded (unreachable), enforced on-chain.

## Mini-apps and forking

A composition is a **mini-app manifest** — content-addressed, so it has a permanent identity, and **forkable**:
a fork records its parent on-chain (App DNA / lineage), so you can trace where an app came from. This makes
ChainRender apps composable building blocks, not one-off artifacts.

Lineage is recorded in two registries, differently: an **app manifest** (`AppRegistry`) carries its `parent` inside
the manifest, so the parent is part of the app's own content hash and `lineageOf` walks the ancestry; a
**composition** (`CompositionRegistry.register(bytes, parent)`) stores the parent next to the bytes, set by whoever
registers those bytes first (it is not part of the hash). A single **component** (`ComponentRegistry`) has no parent
record: the builder's **Fork** reopens a deployed component for editing, and any change is simply a new component with
a new hash.

## Related
- **[Guides → Build a Multi-View App](../guides/multi-view-app.md)**
- **[The Trust Grade](./trust-grade.md)** — how a composition's grade aggregates.
