Installation
Usage
Examples
Basic Syntax Highlighting
Just add a language attribute to enable syntax highlighting.
Line Numbers + Copy Button
Add line-numbers and copy-button attributes for additional features.
Code Folding
Enable with foldable attribute. Click the arrows to collapse/expand regions.
Editable Mode
Add the editable attribute to make code editable. Try editing the CSS below!
Multiple Languages
API Reference
Attributes
| Attribute | Type | Description |
|---|---|---|
language |
string | Programming language for syntax highlighting |
line-numbers |
boolean | Show line number gutter |
copy-button |
boolean | Show copy-to-clipboard button |
editable |
boolean | Make content editable |
foldable |
boolean | Enable code folding |
Events
| Event | Detail | Description |
|---|---|---|
copy |
{ value, success } |
Fired when code is copied |
change |
{ value } |
Fired when content changes (editable mode) |
Event Example
Theming
Switch between built-in themes using the data-theme attribute on any parent element:
Custom Theme
Create your own theme by overriding CSS custom properties: