# Doc page

- **[Atoms](/components/)**

The text page of every app: a large title and the body at a reading width, edited in place like Notion. A toolbar on a selection, '/' for blocks, block handles to add and drag, page-link previews and a slim outline. Markdown in and out; DocPanel shows it in a side panel.

## Preview

doc-page.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { DocPage } from '@/components/klarhimmel/ui/doc-page';

export default function Example() {
  return (
    <Theme theme="brand">
      <DocPage
        title="Booking flow"
        meta="projects/booking.md · v4"
        value={"## Goal\n\nGuests book in **three steps**."}
        onChange={(markdown) => localStorage.setItem('booking', markdown)}
      />
    </Theme>
  );
}
```

## Import

- **CLI**

  ```
  npx shadcn add https://ui.klarhimmel.com/r/doc-page.json
  ```
- **Import**

  ```
  import { DocPage, DocPanel, DocHost } from '@/components/klarhimmel/ui/doc-page';
  ```

- **Files**: doc-page.tsx, doc-page.markdown.ts, in components/klarhimmel/ui/. With it: dialog, doc-host, input, sheet, theme and 2 more. npm: lucide-react, prosekit.
- **Render in**: Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.

## Props

- **DocPage.title**: The page's name, shown large.
- **DocPage.value**: Markdown (storage). A new value from outside replaces the text.
- **DocPage.onChange**: Edits come back as Markdown. Absent: the page is read-only (no handles, '/' menu or selection toolbar).
- **DocPage.meta**: One quiet line under the title: path, version, saved.
- **DocPage.lead**: Above the body, under the title (a description's goal and deliverables).
- **DocPage.onComment**: Shows Comment on a selection: the caller files the quoted words in its thread.
- **DocPage.ask**: Shows Ask on a selection with these actions; the caller runs the assistant on the quoted words.
- **DocPage.bare**: The caller draws the title (a task card): the page is the body only.
- **DocPage.labels**: Every name and menu line. Pass them translated.
- **DocPage.className**: Extra classes, merged after the component's own.
- **DocPanel.open**
- **DocPanel.onOpenChange**
- **DocPanel.fullHref**: Where the page opens full size: shows the full-page button.
- **DocPanel.link**: What Copy link copies. Default: the address in the window.
- **DocPanel.star**: Shows Star; the caller keeps whether it is starred.
- **DocPanel.menu**: Extra lines at the top of the … menu (moving a file between folders).
- **DocPanel.versions**: Shows Version history in the … menu.
- **DocPanel.source**: The whole stored file for Markdown source, when the page edits only part of it (under frontmatter).
- **DocPanel.title**: The page's name, shown large.
- **DocPanel.value**: Markdown (storage). A new value from outside replaces the text.
- **DocPanel.onChange**: Edits come back as Markdown. Absent: the page is read-only (no handles, '/' menu or selection toolbar).
- **DocPanel.meta**: One quiet line under the title: path, version, saved.
- **DocPanel.lead**: Above the body, under the title (a description's goal and deliverables).
- **DocPanel.onComment**: Shows Comment on a selection: the caller files the quoted words in its thread.
- **DocPanel.ask**: Shows Ask on a selection with these actions; the caller runs the assistant on the quoted words.
- **DocPanel.bare**: The caller draws the title (a task card): the page is the body only.
- **DocPanel.labels**: Every name and menu line. Pass them translated.
- **DocPanel.className**: Extra classes, merged after the component's own.

[Previous](/components/rich-text-editor)

[Next](/components/stepper)
