Code

Copyable code block.

Usage

Import the component and pass a code string. The copy button is included by default — no setup required.

const greeting = 'hello world';

With label

Pass a label to show a header bar with a filename or language tag.

App.svelte
import { Button } from 'sve-ui';

<Button color="primary">Ship it</Button>

Copy disabled

Set copyable=false to render a plain read-only block with no toolbar.

export const prerender = true;

Props

Plus every native <div> attribute via prop spreading.

PropTypeDefault
code The code string to display and copy. SSR-safe — no DOM scraping.string
label Optional header label, e.g. a filename or language tag.string
copyable Show the copy-to-clipboard button.booleantrue
class Extra classes merged onto the root element.string