--- ## CodeBlock Read-only code display card with a one-click copy interaction: the copy button swaps its icon and label to a confirmation for two seconds and fires `onCopy`. Renders raw text only — no built-in syntax highlighting; a consumer or the StreamingMarkdown renderer can layer highlighting in via a snippet. Used by StreamingMarkdown for fenced code blocks, and standalone for any code snippet. **Import:** `import { CodeBlock } from '@urbicon-ui/blocks';` ### Examples ```svelte track(c)} /> ``` ### Variants - wrap: false, true (default: false) ### Api | Prop | Type | Required | Default | Description | | --- | --- | :---: | --- | --- | | code | `string` | yes | | The code to display and copy. Rendered as raw text (no highlighting). | | ...CodeBlockVariants | `VariantProps` | no | | Styling variants from CodeBlockVariants | | ...HTMLAttributes | `HTMLAttributes` | no | | HTML attributes (excluding: 'children' | 'class') | | actions | `Snippet` | no | | Extra header actions rendered to the right, before the copy button. | | class | `string` | no | | Extra classes merged onto the root element. | | copiedLabel | `string` | no | | Accessible label shown for two seconds after a successful copy. | | copyLabel | `string` | no | | Accessible label / tooltip for the copy button in its idle state. | | lang | `string` | no | | Language label shown in the header. Display-only — does not drive highlighting. | | onCopy | `(code: string) => void` | no | | Called with the copied code after a successful clipboard write. | | preset | `string` | no | | Apply a named preset registered via ``. Prefer this over `class` overrides when the requested look falls outside the semantic intent palette. | | showCopy | `boolean` | no | | Show the copy button in the header. | | slotClasses | `Partial>` | no | | Per-slot class overrides. Slots: root | header | langLabel | copyButton | pre | code | | unstyled | `boolean` | no | | Remove all default tv classes. | | wrap | `boolean` | no | | Soft-wrap long lines. `false` (default) scrolls horizontally inside the block; `true` wraps with `whitespace-pre-wrap` + word breaking. | Inherited from: - CodeBlockVariants (external) - Omit, 'children' | 'class'> (omit-pattern) ### Types ```ts type SlotNames = keyof ReturnType & string ``` ```ts type VariantProps = Omit< Exclude[0], undefined>, 'class' > ``` ### Slots (slotClasses keys) `root`, `header`, `langLabel`, `copyButton`, `pre`, `code`