Skip to content
LoidoltTheme 0.11.1
Svelte 5

Component

CodeBlock

A monospace block for tokens and URLs — select-all by default, one-press copy on request.

import { CodeBlock } from '@loidolt/theme-svelte';

Example

sk_live_9f2c4d8e1a7b3f6c
https://example.com/proof/pf_q7MU9R2IgF7TuQxRP

Notes

  • Copy success is announced through a persistently mounted status region.
  • Clipboard access can be denied; the text stays selectable either way.

Props

Generated from the component source, so it cannot drift from the implementation.

CodeBlock props
PropTypeDefaultNotes
code required string—
class string—
copiedLabel string'Copied'
copyable booleanfalse
copyLabel string'Copy'
ref bindableHTMLDivElement | nullnull
selectable booleantrueOne click/tap selects the whole value. On by default — this block exists for copying.

Plus the attributes of Omit<HTMLAttributes<HTMLDivElement>, 'children'>, forwarded to the root element.