Skip to content

CodeBlock

Code or command output with a copy button.

Installation

Install CodeBlock from the Fluid Effect UI registry.

Basic

tsx
greeting.tsx

Highlighted

This example passes Shiki-highlighted nodes as children. Copy code uses the original source text.

tsx

Output

API Reference

Types come from the public API. A dash indicates no default is documented here.

CodeBlock props

Public source
PropTypeDefault
idstringRequired
codestringRequired
languagestring'plaintext'
titlestring | View.Content<Msg, R>props.filename
filenamestring—
childrenView.Children<Msg, R>—
lineNumbersboolean—
wrapboolean—
maxHeightnumber—
hideHeaderboolean—
showLineCountboolean—
labelstringprops.filename
classNamestring—
copyControlView.Content<Msg, R>—
onCopiedNoInfer<Msg>—
onCopyFailedNoInfer<Msg>—
shapeShapeVariant'rounded'
sizeSizeVariant'default'
surfacenumber1