VCOS UIVCOS UI
Components

Code Block

Tabbed code panel with animated line reveal and a copy-to-clipboard action.

Preview

Component

Tabbed Code Block

Minimal code panel with tab switching, animated line reveal, and a lightweight copy action.

export function Terminal() {
  return (
    <div className="border border-foreground/10">
      <span>workflow.ts</span>
    </div>
  );
}

Usage

import {
  CodeBlock,
  type CodeBlockExample,
} from "@/components/ui/code-block";

const codeExamples = [
  {
    label: "terminal.tsx",
    code: `export function Terminal() {
  return <div>workflow.ts</div>;
}`,
  },
] satisfies ReadonlyArray<CodeBlockExample>;

<CodeBlock codeExamples={codeExamples} />

Props

CodeBlock

PropTypeDefaultDescription
codeExamplesReadonlyArray<{ label: string; code: string }>RequiredCode tabs rendered in the header and code panel.
initialTabnumber0Zero-based tab index used for the initial active code example.
isVisiblebooleantrueControls the outer slide-and-fade entrance state.
classNamestringOptional classes applied to the outer wrapper.

On this page