Language Label
fun LanguageLabel(language: String, color: Color = LocalContentColor.current.copy(alpha = 0.6f), fontSize: TextUnit = 12.sp)
Default language badge used by SyntaxHighlightedCode's languageLabel slot.
Renders the language identifier as a dimmed Text. Color and size default to values that blend naturally with the code block header when placed inside a SyntaxHighlightedCode block.
Use this helper when toggling label visibility at runtime so you don't need to reconstruct the full default style:
var showLabel by remember { mutableStateOf(true) }
SyntaxHighlightedCode(
code = snippet,
language = "kotlin",
languageLabel = if (showLabel) {
{ SyntaxHighlightedCodeDefaults.LanguageLabel("kotlin") }
} else null,
)Content copied to clipboard
Parameters
language
Text to display (typically the Highlight.js language identifier).
color
Label color. Defaults to LocalContentColor at 60 % opacity, which resolves correctly when inside a SyntaxHighlightedCode block.
font Size
Label font size. Defaults to 12 sp.