Code
Component used to present a block of code in a Toolkit element
Last updated
Component used to present a block of code in a Toolkit element
Last updated
The code block is parsed with Prettier before it is rendered.
Property | Type | Description |
className |
| The Class name to apply to the component
|
editor |
| Reference to the Codemirror object. |
foldGutter |
| Enable folding
|
lineNumbers |
| Hide/show the line numbers.
|
lineWrapping |
| Wrap long lines of code.
|
id |
| ID value used for action Zone.
|
indentUnit |
| Number of spaces used when indenting.
|
readOnly |
| Disable live editing.
|
value |
| The block of code to output |
onChange |
| Called when the change event is triggered. |
The Code component is an implementation of Codemirror and most of the properties are passed through to the Codemirror instance. If you want more control over the Code output you can directly apply configuration to the Codemirror instance via the editor
property.
Triggered when the code value is changed.
You can theme the Code block by supplying the following scss variables before the Toolkit styles are imported: