Code Editor

A complete code editor block: shiki highlighting, language support, line numbers, the toolbar and the status bar, with a controlled document.

Blockscode-editor-blockView JSON

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

Ln 1, Col 1tsx

Installation

Add the item with the shadcn CLI, or copy the source manually.

pnpm dlx shadcn@latest add litingyes/blocove/code-editor-block

Requires 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

Use the block
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.

PropTypeDefault
defaultValuestringBuilt-in demo document
languagestring"tsx"
readOnlybooleanfalse
onChange(value: string) => void-
classNamestring-