# Code Block Extension
## Example
```svelte
```
## Documentation
## Usage
`CoreRichTextEditor` includes `CodeBlockExtension` by default — code blocks work out of the box with syntax highlighting and a copy button.
```svelte
```
## Copy button
`CodeBlockView` includes a copy-to-clipboard button that appears on hover. It shows a checkmark for 2 seconds after copying.
## Custom code block component
Pass `codeBlockComponent` to replace the default rendering with your own Svelte component. Your component receives tiptap's `NodeViewProps`.
```svelte
```
## Sources
Based on "TipTap" (https://tiptap.dev/docs/editor/extensions/nodes/code-block-lowlight)
## API Reference
### CodeBlockExtension
A tiptap Extension that wraps CodeBlockLowlight with a Svelte NodeView featuring a copy button. Add via extensions or extraExtensions.
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| lowlight | `Lowlight` | `-` | The lowlight instance for syntax highlighting. Create with `createLowlight(all)` from the lowlight package. (required) |
| defaultLanguage | `string` | `null` | Default language for new code blocks. |
| codeBlockComponent | `Component` | `-` | Custom Svelte component for rendering code blocks. Receives NodeViewProps from tiptap. |
| HTMLAttributes | `Record` | `{}` | HTML attributes applied to code block elements. |