2022-09-30 11:39:35 -04:00
---
2022-10-25 09:18:18 -04:00
group: Widgets
title: Code
weight: 11
2022-09-30 11:39:35 -04:00
---
The code widget provides a code editor (powered by [Codemirror](https://codemirror.net)) with optional syntax awareness. Can output the raw code value or an object with the selected language and the raw code value.
2022-11-02 13:18:06 -04:00
## Widget options
2022-09-30 11:39:35 -04:00
2022-11-02 13:18:06 -04:00
For common options, see [Common widget options](/docs/widgets#common-widget-options).
| Name | Type | Default | Description |
| ------------------------ | ------- | -------------------------------- | -------------------------------------------------------------------- |
| default_language | string | | _Optional_. Default language to use |
| allow_language_selection | boolean | `false` | _Optional_. Allows language syntax to be changed |
| keys | boolean | `{ code: 'code', lang: 'lang' }` | _Optional_. Sets key names for code and lang if outputting an object |
| output_code_only | string | `true` | _Optional_. Set to `true` to output the string value only |
## Example
```yaml
name: code
label: Code
widget: code
```