Code Editor
A complete code editor block: shiki highlighting, language support, line numbers, the toolbar and the status bar, with a controlled document.
The block installs a single file and depends on the editor shell, the shiki highlighting, the language item and the line numbers, so the CLI brings a working editor. Replace `defaultValue` with the code your app edits.
Preview
Installation
Add the item with the shadcn CLI, or copy the source manually.
pnpm dlx shadcn@latest add litingyes/blocove/code-editor-blockRequires a shadcn/ui project set up with Base UI primitives. Blocove is developed against the b0 preset, but it installs no base config or theme tokens: your own preset, fonts and colors stay in place.
Or install from the namespace after adding the registry: npx shadcn@latest add @blocove/code-editor-block
Usage
import { CodeEditorBlock } from "@/components/blocove/code-editor-block"
export function ReviewPanel() { return ( <CodeEditorBlock defaultValue="const answer = 42" language="typescript" onChange={value => console.log(value)} /> )}API Reference
Props accepted by the exported components.
CodeEditorBlock
The editor with the shiki highlighting, the language item, the line numbers, the toolbar and the status bar already composed.
| Prop | Type | Default |
|---|---|---|
defaultValue | string | Built-in demo document |
language | string | "tsx" |
readOnly | boolean | false |
onChange | (value: string) => void | - |
className | string | - |