Code Block
The CodeBlock component provides syntax highlighting, line numbers, and copy to clipboard functionality for code blocks.
Installation
If you prefer using jsrepo, please install via the command below:
Props
Code
| Name | Type | Default |
|---|---|---|
code | string | |
lang | SupportedLanguage | 'typescript' |
variant | 'default' | 'ghost' | 'default' |
hideLines | boolean | false |
highlight | (number | [number, number])[] | [] |
class | string | |
children | Snippet | |
ref | HTMLDivElement | |
...restProps | HTMLAttributes<HTMLDivElement> | |
CodeCopyButton
| Name | Type | Default |
|---|---|---|
variant | ButtonProps['variant'] | 'ghost' |
size | ButtonProps['size'] | 'icon' |
class | string | |
ref | HTMLButtonElement | |
...restProps | CopyButtonProps | |
CodeOverflow
| Name | Type | Default |
|---|---|---|
collapsed | boolean | true |
class | string | |
children | Snippet | |
...restProps | HTMLAttributes<HTMLDivElement> | |