SyntaxHighlightedTextField
Renders an editable, syntax-highlighted code surface backed by IncrementalHighlighter.
Internally layers a transparent BasicTextField beneath a Text that paints the highlighted form, sharing the same TextStyle and ScrollState so glyphs in both children sit at identical positions. The BasicTextField owns cursor, selection, and IME; the overlay Text owns visible colour.
For non-Material3 chrome or custom layouts, use rememberSyntaxHighlightedString directly and compose your own overlay.
Parameters
Source of truth for the editable text.
Tree-sitter Language driving the highlighting.
Maps capture names to androidx.compose.ui.text.SpanStyles. Defaults to the value of LocalSyntaxTheme.
Base text style. The overlay Text uses it as-is; the underlying BasicTextField copies it with Color.Transparent so its glyphs remain invisible while still measuring.
Caret brush. Defaults to the Material3 primary colour.
Defaults to TextFieldLineLimits.MultiLine — code-editor flow.
Vertical scroll. The same instance is shared by overlay and underlay.