Code Block
A lightweight React component based on SHIKI that provides syntax highlighting using Shiki with built-in copy functionality. Perfect for displaying code snippets in documentation, blogs, and developer tools with dark/light theme support.
A lightweight React component based on SHIKI that provides syntax highlighting using Shiki with built-in copy functionality. Perfect for displaying code snippets in documentation, blogs, and developer tools with dark/light theme support.
| Prop | Type | Default | Description |
|---|---|---|---|
code | string | Required | The code string to highlight |
lang | string | 'tsx' | Programming language for syntax highlighting |
className | string | undefined | Additional CSS classes for styling |
The component supports all languages that Shiki supports, including:
javascript, typescript, tsx, jsxpython, java, c, cpp, csharphtml, css, scss, sassjson, yaml, toml, xmlmarkdown, mdxbash, shell, powershell