defaultEditorFontFamily
Default font family for the editor.
Uses FontFamily.Monospace, which maps to the platform's default monospace font on JVM, Android, iOS, and macOS.
wasmJs / CanvasKit limitation
On wasmJs, Compose renders via CanvasKit (Skiko), which maintains its own internal font registry separate from the OS font system. Generic family names such as "Roboto Mono" or "JetBrains Mono" will not resolve unless the font has been explicitly registered with CanvasKit. Even FontFamily.Monospace may fall back to a generic sans-serif glyph.
To guarantee a specific monospace font on wasmJs (and all other targets), bundle the font as a Compose Resource and load it via org.jetbrains.compose.resources.Font:
// In a @Composable context — Font() requires composition
val monoFont = FontFamily(Font(Res.font.JetBrainsMono_Regular))
val fontExtension = editorContentStyle.of(TextStyle(fontFamily = monoFont))
// Pass the extension when creating the EditorState:
val state = EditorState.create(
EditorStateConfig(extensions = listOf(basicSetup, fontExtension))
)Content copied to clipboard
See editorContentStyle for the full font-override API.