CodeBlock

Highlighted code on a well in Kaeso's syntax palette, in every common language: copy in the header or on hover, tabs, line numbers, collapse.

View source
from openai import OpenAIimport os client = OpenAI(    base_url="https://kaeso.example.com/v1",    api_key=os.environ["KAESO_API_KEY"],) response = client.responses.create(    model="gpt-5",    input="Write one sentence about gateways.",)print(response.output_text)
import { CodeBlock } from "@logicplanes/kaeso-ui";

Props

  • code
    string

    The code to show.

  • collapseAfter
    number = 24

    Collapse beyond this many lines (24 by default; 0 never collapses).

  • copy
    boolean = true

    Hide the copy circle.

  • highlightLines
    number[] = []

    1-based line numbers to highlight.

  • lang
    CodeLang = ts

    The language to highlight (ts by default), or text to show the code plain. resolveCodeLang turns a Markdown fence name such as py or sh into one.

  • lineNumbers
    boolean

    Shows line numbers.

  • onTabChange
    ((label: string) => void)

    Called with the label of the tab a person chooses, to remember it.

  • surface
    "well" | "plain" = well

    On a flat plate (well) or on the panel itself (plain), such as inside a plate of your own.

  • tab
    string

    The label of the tab to show, such as a language the reader chose before. A label the block lacks leaves its own choice.

  • tabs
    CodeTab[]

    Several versions: "Python · Node · curl", shown as pill tabs in the title bar, the chosen one raised on the plate as in a segmented control.

  • title
    ReactNode

    A file name in the title bar.

  • wrap
    boolean | "phone" = false

    Long lines wrap instead of scrolling sideways: code in a narrow column (a model's response). They break at spaces, never inside a flag or a name unless it is wider than the line. phone wraps them only below 640px, with wrapped parts indented, and scrolls from there up.