Interface used by Text composables to override text size to automatically grow or shrink text to fill the layout bounds.
TextAutoSizeBasicTextSample
/** Sample of using [TextAutoSize.StepBased] to auto-size text. */
@Sampled
@Composable
fun TextAutoSizeBasicTextSample() {
Box(modifier = Modifier.size(200.dp)) {
// The text will find the biggest available font size that fits in the box.
BasicText(text = "Hello World", autoSize = TextAutoSize.StepBased())
}
}
/**
* Example of a custom [TextAutoSize] implementation that uses a list of [TextUnit] presets to find
* the fitting font size.
*/