Skip to content
kapable

CodeBlock

Foundations · 1 export · v0.1.0 · showcase

Accessible, horizontally scrollable plain-code output without syntax highlighting.

Browse 72 component families
npm install @kapable/remix-kit

Usage

CodeBlock usage
<CodeBlock code={command} label="Install command" lang="sh" />

API

CodeBlock API

CodeBlockProps

A code block in the drafting grammar: plain mono on the raised-quiet channel, horizontally scrollable as a keyboard-reachable named group. It deliberately is not a landmark: docs pages often contain many blocks, and dozens of identical regions make landmark navigation worse. Code is plain text by default; callers may pass safe server-rendered token data. Zero JS. Compose a CopyButton beside it in an island when copying matters (the block is position:relative for exactly that overlay).

CodeBlock props
proptypenotes
codestringThe code, verbatim.
tokens?CodeToken[]Optional server-rendered tokens. Falls back to `code` if their text differs.
lang?stringLanguage hint exposed as a data attribute.
label?stringAccessible name for the scroll region. Default 'Code'.
dense?booleanTighter padding + smaller type for dense listings.
mix?MixInput

More in Foundations

More in Foundations