# Doc page

One page anatomy for documentation: an icon, title and summary header, a reading column and an On this page rail that becomes a bar on a narrow pane.

Section: Blocks / Layouts
Page: https://ui.heyramzi.com/components/doc-page
Import path: `@heyramzi/ui/components/docs`

## Import

```ts
import { DocPage } from "@heyramzi/ui/components/docs";
```

## Usage

```svelte
<DocPage
  title="Learnings"
  summary="What engagements taught"
  headings={[{ id: "what-worked", label: "What worked" }]}
  contentsLabel="On this page"
>
  <h2 id="what-worked">What worked</h2>
  <p>Splitting the call in two.</p>
</DocPage>
```

## Demo

```svelte
<script lang="ts">
	import { DocPage } from "@heyramzi/ui/components/docs";
	import { Lightbulb } from "phosphor-svelte";

	const sections = [
		{
			id: "what-worked",
			label: "What worked",
			body: "Splitting the call in two: the business logic first, then the tool on screen. Everyone had the whole picture before any detail landed.",
		},
		{
			id: "what-to-fix",
			label: "What to fix",
			body: "The specs weren't clear enough before the call. Refine the task descriptions before the kickoff, not after it.",
		},
		{
			id: "access",
			label: "Access on day one",
			body: "Spaces weren't shared and the field manager wouldn't open. Check workspace access during onboarding.",
		},
		{
			id: "reusable",
			label: "What became reusable",
			body: "Three-layer time aggregation, threshold alerts and the invoice cap with carryover.",
		},
	];
</script>

<!-- w-full: the doc page is a size container, so it has no width of its own to shrink to. -->
<div
	class="flex h-[520px] w-full flex-col overflow-hidden rounded-xl border border-border bg-background"
>
	<DocPage
		title="Learnings"
		summary="What engagements taught"
		icon={Lightbulb}
		section="Patterns and learnings"
		updated="Updated 20 Oct 2026"
		headings={sections.map(({ id, label }) => ({ id, label }))}
		contentsLabel="On this page"
	>
		{#each sections as s (s.id)}
			<h2 id={s.id} class="mt-8 mb-3 font-heading text-lg font-semibold text-foreground first:mt-0">
				{s.label}
			</h2>
			<p class="mb-24 text-[15px] leading-relaxed text-muted-foreground">{s.body}</p>
		{/each}
	</DocPage>
</div>
```

## API

### DocPage

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `title` | `string` |  | required |
| `summary` | `string` |  | One line under the title. Optional: a page with nothing to add leaves it out. |
| `icon` | `Component<{ class?: string; weight?: "bold"; "aria-hidden"?: boolean \| "true" \| "false"; }>` |  |  |
| `section` | `string` |  | Where the page lives, as a reader would say it: "Marketing / Reports". |
| `updated` | `string` |  | Already worded and localised: "Updated 30 Jul 2026". |
| `actions` | `Snippet` |  | Room at the right of the title for a page's own controls. |
| `headings` | `DocHeading[]` | `[]` | The document's h2s, which the contents rail walks. Under two, there's no rail. |
| `contentsLabel` | `string` |  | required. The rail's name: "On this page". |
| `locate` | `LocateHeading` |  | Supplied by a document that lives in a frame; the default reads the DOM by id. |
| `resetKey` | `string` |  | Changes when the page is swapped without navigation, so the pane returns to the top. |
| `measure` | `"prose" \| "wide"` | `"prose"` | The reading column's width. `wide` is for a document that brings tables and boards. |
| `scroller` | `HTMLElement \| null` | `null` | bindable. The scroll box, for a document that has to place things inside it. |
| `children` | `Snippet` |  | required |

### OnThisPage

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `items` | `DocHeading[]` |  | required |
| `active` | `string` |  | required. The id the reader is in. |
| `label` | `string` |  | required. What the rail is called: "On this page". Passed in so the library holds no copy. |
| `onSelect` | `(id: string) => void` |  | required |
| `variant` | `"rail" \| "bar" \| "ticks"` | `"rail"` | `rail` sits beside the document, `bar` replaces it on a narrow pane, and `ticks` marks each heading in the gutter with a card of headings on hover or focus. |
