Code Block API
View componentThe full prop reference for the Code Block component. A presentational code block with an optional filename header, line numbers, and a built-in copy button.
Import
tsx
import { CodeBlock } from '@structyl/styled';Props
CodeBlock
A presentational code block with an optional filename/language header, a line-number gutter, line highlighting, and a built-in copy button. Does not perform syntax highlighting. Extends the native pre element.
| Prop | Type | Default |
|---|---|---|
| code# | stringThe raw source code to display. Required. | — |
| language# | string | undefinedLanguage label shown in the header. | — |
| filename# | string | undefinedFilename shown in the header. | — |
| showLineNumbers# | booleanRender a line-number gutter. | false |
| copyable# | booleanShow the copy-to-clipboard button. | true |
| highlightLines# | number[]1-based line numbers to highlight. | [] |
Source code
If you didn't find what you need here, read the component implementation .