Skip to content
Klarhimmel UI

Doc page

Loading the page

npx shadcn add https://ui.klarhimmel.com/r/doc-page.json
DetailsAbout, usage, props and more

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

Loading the page

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

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

PropTypeDefaultDescription
DocPage.titlestringrequiredThe page's name, shown large.
DocPage.valuestringrequiredMarkdown (storage). A new value from outside replaces the text.
DocPage.onChange(markdown: string) => void-Edits come back as Markdown. Absent: the page is read-only (no handles, '/' menu or selection toolbar).
DocPage.metastring-One quiet line under the title: path, version, saved.
DocPage.leadReactNode-Above the body, under the title (a description's goal and deliverables).
DocPage.onComment(quote: string) => void-Shows Comment on a selection: the caller files the quoted words in its thread.
DocPage.ask{ actions: string[]; onAsk(action: string, quote: string): void }-Shows Ask on a selection with these actions; the caller runs the assistant on the quoted words.
DocPage.bareboolean-The caller draws the title (a task card): the page is the body only.
DocPage.labelsPartial<DocPageLabels>-Every name and menu line. Pass them translated.
DocPage.classNamestring-Extra classes, merged after the component's own.
DocPanel.openbooleanrequired
DocPanel.onOpenChange(open: boolean) => voidrequired
DocPanel.fullHrefstring-Where the page opens full size: shows the full-page button.
DocPanel.linkstring-What Copy link copies. Default: the address in the window.
DocPanel.star{ on: boolean; onChange(on: boolean): void }-Shows Star; the caller keeps whether it is starred.
DocPanel.menu{ label: string; onSelect(): void }[][]Extra lines at the top of the … menu (moving a file between folders).
DocPanel.versions{ version: number; note: string; when: string }[]-Shows Version history in the … menu.
DocPanel.source{ value: string; onChange: (markdown: string) => void }-The whole stored file for Markdown source, when the page edits only part of it (under frontmatter).
DocPanel.titlestringrequiredThe page's name, shown large.
DocPanel.valuestringrequiredMarkdown (storage). A new value from outside replaces the text.
DocPanel.onChange(markdown: string) => void-Edits come back as Markdown. Absent: the page is read-only (no handles, '/' menu or selection toolbar).
DocPanel.metastring-One quiet line under the title: path, version, saved.
DocPanel.leadReactNode-Above the body, under the title (a description's goal and deliverables).
DocPanel.onComment(quote: string) => void-Shows Comment on a selection: the caller files the quoted words in its thread.
DocPanel.ask{ actions: string[]; onAsk(action: string, quote: string): void }-Shows Ask on a selection with these actions; the caller runs the assistant on the quoted words.
DocPanel.bareboolean-The caller draws the title (a task card): the page is the body only.
DocPanel.labelsPartial<DocPageLabels>-Every name and menu line. Pass them translated.
DocPanel.classNamestring-Extra classes, merged after the component's own.