textOrNull

fun String?.textOrNull(centered: Boolean = false): @Composable () -> Unit?

Wraps this optional String into a plain @Composable lambda rendering it via a Material 3 Text — the usual way a tile with an optional text field (e.g. TextField.label/placeholder/ supportingText) conditionally renders it without an explicit if (value != null) at every call site.

Return

a composable rendering this text, or null if the receiver itself is null.

Parameters

centered

whether the text is center-aligned instead of the default start alignment.