CodeField

The Code field type used in Statamic.

Type Definition

Code editor with syntax highlighting.

type 
CodeField
<
T
extends
CodeLanguage
=
CodeLanguage
> = {
code
: string | null;
mode
:
T
;
value
: string | null;
};
The programming language/mode.
Defaults to all supported modes.

CodeLanguage

Code language type for Code fieldtype.

type 
CodeLanguage
= "clike"
| "css" | "diff" | "go" | "haml" | "handlebars" | "htmlmixed" | "less" | "markdown" | "gfm" | "nginx" | "text/x-java" | "javascript" | "jsx" | "text/x-objectivec" | "php" | "python" | "ruby" | "scss" | "shell" | "sql" | "twig" | "vue" | "xml" | "yaml-frontmatter";