Skip to content
caliper ui docs

Blocks

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
pnpm dlx shadcn@latest add @caliper/code-result-block

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.

Installs components/ui/code-result-block.tsxDepends on @radix-ui/react-slot, lucide-reactMotion none in component source

When to use

Use it for

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

Skip it when

  • 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.

Usage

Import it from your copy of the source. The example behind the preview comes with the source. It is built from changedLines and CodeResultBlock.

example.tsx
import { changedLines, CodeResultBlock } from "@/components/ui/code-result-block"

The worked example comes with Pro

The 32-line example behind the preview opens here, ready to copy.

  • 626 Pro parts, blocks and page templates, all with source
  • $149 once, with lifetime updates. No renewal
  • A full refund within 14 days if it is not for you
Checking your licence…

API reference

changedLines

component

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

CodeResultBlock

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

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.

KeyBehaviour
→Moves to the next item or value.
←Moves to the previous item or value.
HomeJumps to the first item or the minimum.
EndJumps to the last item or the maximum.

Motion

It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.

All Hero, FAQ & contact examples