Skip to content
caliper ui pro docs

Code result block

Code beside what it makes. Each tab is one small change; switching marks the changed lines and fades the result to its new state. Real text with a copy button.

Pro

For developers

One prop, one visible change

Caliper UI components are plain React with the states built in. Change a line and see what it does.

reminders.tsx

<Card>
  <Switch label="Invoice reminders" />
  <Button>
    Save schedule
  </Button>
</Card>

Invoice reminders

Email customers 3 days before an invoice is due.

When to use

  • Developer landing pages and docs overviews.
  • Showing that a prop or a line of config does one visible thing.

When not to use

  • Long programs; link to the docs.
  • Typing animations; readers should not wait for code.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/code-result-block

Adds its 6 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

API reference

changedLines

0 props

No props of its own; it accepts the native props of its root element.

CodeResultBlock

5 props
PropTypeDefault
eyebrowstring—
title *string—
leadstring—
examples *readonly CodeExample[]—
classNamestring—

Keyboard

→
Moves to the next item or value.
←
Moves to the previous item or value.
Home
Jumps to the first item or the minimum.
End
Jumps to the last item or the maximum.

Accessibility

It exposes tablist, tab, tabpanel and region semantics, with aria-label, aria-selected, aria-controls, aria-labelledby, aria-hidden and aria-live kept in step with state. Changes that matter are announced through a live region.

Notes for AI

Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.

/docs/components/code-result-block.md

The index of every part is at /llms.txt.

More in Hero, FAQ & contact