Stylish Code
fun StylishCode(text: String, modifier: Modifier = Modifier, containerColor: Color = MaterialTheme.colorScheme.surfaceVariant, contentColor: Color = MaterialTheme.colorScheme.onSurfaceVariant, shape: Shape = RectangleShape, textStyle: TextStyle = MaterialTheme.typography.bodySmall.copy(
fontFamily = FontFamily.Monospace,
))
A monospaced inline code display — the web "Code" pattern from Chakra UI and Ant Design.
Parameters
text
The code text to display.
modifier
Modifier applied to the root surface.
container Color
Background of the code block. Defaults to MaterialTheme.colorScheme.surfaceVariant.
content Color
Foreground of the code text. Defaults to MaterialTheme.colorScheme.onSurfaceVariant.
shape
Corner shape. Defaults to a small rounded rectangle.
text Style
Typography of the code. Defaults to bodySmall in a monospace family.