editorContentStyle
Facet for editor content text styling (font family, size, line height, color).
Multiple values are merged via TextStyle.merge — later extensions override earlier ones field-by-field. If no extension specifies a text color, the editor falls back to EditorTheme.foreground.
// Override just font size:
editorContentStyle.of(TextStyle(fontSize = 18.sp, lineHeight = (18 * 1.4).sp))
// Override font family (works on all targets including wasmJs):
editorContentStyle.of(TextStyle(fontFamily = myFontFamily))Content copied to clipboard
wasmJs font loading
On wasmJs system font names are not available to CanvasKit — fonts must be loaded from bundled Compose Resources. Because org.jetbrains.compose.resources.Font requires a composable context, build the extension inside a @Composable function and pass it to EditorState:
@Composable
fun MyEditor() {
val monoFont = FontFamily(Font(Res.font.JetBrainsMono_Regular))
val session = rememberEditorSession(
EditorStateConfig(
extensions = listOf(
basicSetup,
editorContentStyle.of(TextStyle(fontFamily = monoFont))
)
)
)
KodeMirror(session)
}Content copied to clipboard
See defaultEditorFontFamily for background on the wasmJs limitation.