{
  "purpose": "Present selectable plain code and an independently operable copy-to-clipboard action.",
  "avoid": "Syntax color alone must not carry the explanation.",
  "classification": "source-bound-reference-with-explicit-decisions",
  "basis": "Pinned React/primitive sources lead API, lifecycle and semantics; native visual observations and explicit reference decisions are mapped in figma/traceability.json.",
  "profile": "content-display/1",
  "profileRationale": "Meaningful content or content container; not classified as decorative. Any interactive descendants need separate behavior and accessibility contracts.",
  "componentId": "shadcn:CodeBlock",
  "sourceRule": "Root variant=default|destructive and size=default|sm only style div content. Content is native pre with nested code, dir=ltr and tabIndex0; wrap defaultsfalse, lineNumbersfalse, startLine1 controls the CSS line counter. With string children and numbering, one trailing newline is removed before splitting; empty CodeBlockLine deliberately emits a newline. No syntax highlighter or executable code engine is built in. CopyButton requires value:string, defaults ghost/icon-xs, calls caller onClick before navigator.clipboard.writeText(value), and does not inspect defaultPrevented. Successful promise sets copied=true, aria-label=Copied and a polite live text; first copied=true schedules reset after2000ms. Repeated success while already copied does not restart that effect timer. Rejected promises are swallowed, preserving the previous copied state; no onCopied/onCopyError event exists. Missing navigator.clipboard can throw synchronously before the promise catch. This reference requires a supported secure clipboard context for Copy and provides persistent native text-selection instructions as the fallback. The copy value is exact caller text, not inferred from formatted/numbered DOM.",
  "keyboardAndFocus": "Native Copy Button supports Enter/Space; disabled suppresses its click. The focusable pre supports native selection/scrolling and Tab leaves it. Escape does not revert code or cancel a clipboard write already requested. Copy does not move focus. A descriptive code heading/instructions are caller supplied, not automatic CodeBlockTitle semantics.",
  "contentAlternative": "Full code text/native input value/labelled slide text remains available without icon, fake caret, motion or hover. Caller owns exact help/error/recovery wording.",
  "updatesAndDescendants": "Root variant=default|destructive and size=default|sm only style div content. Content is native pre with nested code, dir=ltr and tabIndex0; wrap defaultsfalse, lineNumbersfalse, startLine1 controls the CSS line counter. With string children and numbering, one trailing newline is removed before splitting; empty CodeBlockLine deliberately emits a newline. No syntax highlighter or executable code engine is built in. CopyButton requires value:string, defaults ghost/icon-xs, calls caller onClick before navigator.clipboard.writeText(value), and does not inspect defaultPrevented. Successful promise sets copied=true, aria-label=Copied and a polite live text; first copied=true schedules reset after2000ms. Repeated success while already copied does not restart that effect timer. Rejected promises are swallowed, preserving the previous copied state; no onCopied/onCopyError event exists. Missing navigator.clipboard can throw synchronously before the promise catch. This reference requires a supported secure clipboard context for Copy and provides persistent native text-selection instructions as the fallback. The copy value is exact caller text, not inferred from formatted/numbered DOM. Native Copy Button supports Enter/Space; disabled suppresses its click. The focusable pre supports native selection/scrolling and Tab leaves it. Escape does not revert code or cancel a clipboard write already requested. Copy does not move focus. A descriptive code heading/instructions are caller supplied, not automatic CodeBlockTitle semantics.",
  "sourceCommit": "45bbf9ba23c9c0f63d38887947e5fb06f59c7da3",
  "sourceFiles": [
    "sources/shadcn/apps/v4/registry/bases/base/ui/code-block.tsx.source",
    "sources/shadcn/apps/v4/content/docs/components/base/code-block.mdx.source",
    "sources/shadcn/apps/v4/registry/bases/base/examples/code-block-example.tsx.source"
  ],
  "sourcePackages": [
    "React19.3.1 and native Clipboard API"
  ],
  "referenceDecision": "Concrete selectable code, exact caller copy value, caller heading/selection instructions, explicit compact layout and diff color/text legend are reference composition. Clipboard rejection does not invent an onCopyError callback; the pinned source behavior remains visible. Supplied Geist Mono Medium matches observed native text runs.",
  "visualContract": {
    "layoutPolicy": "The actual source pre/code/line hierarchy and public wrap/lineNumbers/startLine semantics lead the recipe. Native 18px surface corners,16px section/content insets and 8px header gap remain semantic metrics; source 448px example widths are never fixed. Actual native text runs and line-number text specify Geist Mono Medium 14/20, despite a22.75px artwork row frame; the pinned supplied font follows those text values. Compact 12/16 and 28rem maximum scroll height are explicit reference decisions. Native unbound highlighted zinc at50% is retained for light mode, with an explicit 10% light foreground tint in dark mode for readable text; added-line colors and destructive inset stroke are explicit visual decisions because pinned wrapper classes define the variants without these scalar values. The visible +/− text and legend carry diff meaning independently of color. Code content remains LTR inside RTL hosts. Counter-only line numbers have empty speech alternative where supported, and Copy always uses the caller value rather than rendered numbers or diff DOM. Headerless actions reveal on hover, focus-within and coarse pointers; the real native Button remains independently reachable. Copy success,2000ms reset and swallowed rejection remain actual source behavior; persistent selection instructions provide the concrete fallback. Root never executes code or adds a syntax highlighter.",
    "parts": "component.json#/partBindings",
    "tokenBindings": "component.json#/visualContract/tokens",
    "sourceEvidence": "figma/traceability.json"
  }
}
