Code Example 2 - Explanation steps that highlight lines

A two-column walkthrough where selecting a numbered explanation step highlights the matching lines in a code window and dims the rest. Use it to explain how an SDK integration works line by line on a docs or product page.

About Code Example 2

A two-column walkthrough where selecting a numbered explanation step highlights the matching lines in a code window and dims the rest. Use it to explain how an SDK integration works line by line on a docs or product page.

Code Example 2 is a free code example block for React, built on shadcn/ui and Tailwind CSS. It ships as 121 lines of TypeScript you own: every piece of copy is a prop with a sensible default, so you can drop it in and replace the content without touching the layout.

  • code
  • walkthrough
  • steps
  • highlight
  • explanation
  • sdk

Installation

  1. Add the Chocolate UI registry to your components.json (see the installation guide).
  2. Run the shadcn CLI:
npx shadcn@latest add @chocolate/code-example-02

Uses: reveal, utils.

Usage

import CodeExample02 from "@/components/blocks/code-example-02"

export default function Page() {
  return <CodeExample02 />
}

FAQ