ZUI

Search documentation

Find a page or a heading.

Highlighted Code

A mono code element that renders tokenized lines from the shared Shiki highlighter, falling back to its raw children until they arrive.

tsx

Installation

bash

Usage

tsx
tsx

lines is what highlightToLines resolves to; while it is still null, children (the raw source) keeps the code readable before the grammar loads. Use it for already-tokenized source with no card chrome; for a self-contained, read-only block with a header, copy action and line numbers, compose Code Block instead.

API reference

HighlightedCode

Renders a code and takes every prop a code takes, plus:

Tokenized lines render as styled spans in order, with a newline between lines; while lines is null it renders children instead. It sets data-slot="highlighted-code".