Theming
Variables and classes on the editor shell.
Set --blockcn-* on a parent. Each variable falls back to a shadcn token or a built-in colour. className and classNames add classes. The parts expose data-blockcn-root, data-blockcn-frame, and data-blockcn-content. The full list is on Theming.
.themed-editor {
--blockcn-surface: var(--background);
--blockcn-drop-cursor: var(--primary);
}This page's code block is examples/recipes/theming.tsx. pnpm --dir docs typecheck compiles that file and fails if this block drifts.
import type { ReactNode } from "react";
import type { Editor as EditorInstance } from "@tiptap/core";
import { Editor } from "@/components/editor/Editor";
/** Override `--blockcn-*` on a parent. `classNames` adds classes without editing `editor.css`. */
export function ThemedEditor({ editor, children }: { editor: EditorInstance | null; children?: ReactNode }) {
return (
<div className="themed-editor">
<Editor editor={editor} className="rounded-lg" classNames={{ frame: "max-w-3xl", content: "min-h-40" }}>
{children}
</Editor>
</div>
);
}