variant | "default" | "singleLine" | "default" | variant="default" | singleLine uses the same Leading, Content, and Trailing slot arrangement as Input. It displays one line and omits height resizing, language label, line numbers, fullscreen view, and vertical scrolling. |
code | string | "" | code="Example" | Code string to display. |
language | string | "" | language="Example" | Language identifier and formatting parser. Supports Svelte, JavaScript, JSX, TypeScript, TSX, HTML, CSS, SCSS, Less, JSON, JSONC, YAML, Markdown, and GraphQL aliases. When empty, detects Svelte/HTML, JSON, or JS/TS from content. An unknown explicit language preserves the source text. |
format | boolean | true | format | Format according to language by default. The normal view, fullscreen view, line numbers, and copy action share the result. false preserves source text; singleLine always preserves it. Source text is also preserved when parsing fails, the language is unknown, or input exceeds 200,000 characters. |
showLanguage | boolean | true | showLanguage | Show the language label. |
showLineNumbers | boolean | false | showLineNumbers | Show code line numbers in normal and fullscreen views, avoiding a horizontal jump when switching views. |
showCopyButton | boolean | true | showCopyButton | Show the built-in copy button. |
showExpandButton | boolean | true | showExpandButton | Show the built-in fullscreen button. |
horizontalScrollbarVisibility | "always" | "hover" | "always" | horizontalScrollbarVisibility="always" | Show the horizontal scrollbar whenever content overflows, or only while the pointer is over the code block. |
visibleLines | number | 5 | visibleLines={42} | Maximum number of visible lines in the normal view. Shorter content sets its own height; longer content scrolls. The fullscreen view has no such limit. |
copyTimeout | number | 2000 | copyTimeout={42} | How long the copied Check icon stays visible, in milliseconds, before the Copy icon returns. |
children | Snippet | — | <CodeBlock>Content</CodeBlock> | Code content or accessory source. Plain text becomes code; a child with as="trailing" replaces the right action area. |
parts | ComponentPartsOf<{ Indicator: typeof Indicator; CopyButton: typeof CopyButton; ExpandButton: typeof ExpandButton; }> | — | parts={partsOptions} | Configure only the built-in CopyButton, ExpandButton, and Indicator. Explicit child accessories do not inherit these settings. Button emphasis can be set here. |