A [Modifier] that can add padding to position the content according to specified distances from its bounds to an [alignment line][AlignmentLine].
PaddingFromSample
@Composable
fun PaddingFromSample() {
// We want to have 30.sp distance from the top of the layout box to the baseline of the
// first line of text.
val distanceToBaseline = 30.sp
// We convert the 30.sp value to dps, which is required for the paddingFrom API.
val distanceToBaselineDp = with(LocalDensity.current) { distanceToBaseline.toDp() }
// The result will be a layout with 30.sp distance from the top of the layout box to the
// baseline of the first line of text.
Text(
text = "This is an example.",
modifier = Modifier.paddingFrom(FirstBaseline, before = distanceToBaselineDp),
)
}