CodeEditorThe CodeEditor component provides a syntax-highlighted code editing experience. It is useful for scenarios where users need to input or edit code snippets.
Navigation

CodeEditor

The CodeEditor component provides a syntax-highlighted code editing experience. It is useful for scenarios where users need to input or edit code snippets.

Usage

var code by remember { mutableStateOf("fun main() { println(\"Hello\") }") }

CodeEditor(
    value = code,
    onValueChange = { code = it },
    language = "kotlin",
    readOnly = false,
    modifier = Modifier().height(300.px).border(1.px, BorderStyle.Solid, "#ccc")
)

Parameters

NameTypeDescription
valueStringThe current code content.
onValueChange(String) -> UnitCallback invoked when the code content changes.
languageStringThe programming language for syntax highlighting (e.g., "kotlin", "javascript", "html").
readOnlyBooleanWhether the editor is read-only. Defaults to false.
modifierModifierThe modifier to apply to the editor container.

Platform Support

PlatformSupportNotes
JVM (SSR)PartialRenders a static code block with syntax highlighting classes. Client-side hydration enables editing.
JS (Client)FullRenders an interactive code editor (e.g., using PrismJS or similar).
Wasm (Client)FullRenders an interactive code editor.
Architected in Kotlin. Rendered with Materia. Powered by Aether.
© 2026 Yousef.