VerticalText

Functions summary

Unit
@Composable
VerticalText(
    text: CharSequence,
    modifier: Modifier,
    style: VerticalTextStyle,
    overflow: TextOverflow,
    maxColumns: Int,
    minColumns: Int,
    orientation: TextOrientation
)

Displays text laid out vertically with VerticalTextLayout.

Functions

@Composable
fun VerticalText(
    text: CharSequence,
    modifier: Modifier = Modifier,
    style: VerticalTextStyle = VerticalTextStyle.Default,
    overflow: TextOverflow = TextOverflow.Clip,
    maxColumns: Int = Int.MAX_VALUE,
    minColumns: Int = 1,
    orientation: TextOrientation = TextOrientation.Mixed
): Unit

Displays text laid out vertically with VerticalTextLayout.

Accepts a plain CharSequence, an AnnotatedString, or an Android android.text.Spanned with vertical spans such as androidx.text.vertical.RubySpan, androidx.text.vertical.EmphasisSpan, androidx.text.vertical.FontShearSpan, and androidx.text.vertical.TextOrientationSpan. buildVerticalText creates such a android.text.Spanned. Treat an android.text.Spannable as immutable once passed: later span edits are not observed.

For an AnnotatedString, honors androidx.compose.ui.text.SpanStyle.color, androidx.compose.ui.text.SpanStyle.fontSize, androidx.compose.ui.text.SpanStyle.fontWeight, androidx.compose.ui.text.SpanStyle.fontStyle, androidx.compose.ui.text.SpanStyle.background, and androidx.compose.ui.text.SpanStyle.letterSpacing. Ignores other span styles and all paragraph styles.

Columns start at the right edge of the layout and advance to the left. The width wraps to the columns that fit in the height constraint, capped at maxColumns and padded to minColumns, and the height wraps to the tallest drawn column.

Parameters
text: CharSequence

text to display

modifier: Modifier = Modifier

Modifier to apply to this layout node

style: VerticalTextStyle = VerticalTextStyle.Default

VerticalTextStyle for text measurement and rendering

overflow: TextOverflow = TextOverflow.Clip

how to handle text that overflows the bounds. TextOverflow.Visible draws past the bounds; every other value clips. No value adds an ellipsis

maxColumns: Int = Int.MAX_VALUE

maximum number of columns to measure and draw. 0 measures and draws no column. Defaults to no limit

minColumns: Int = 1

minimum number of columns to reserve in the measured width. 0 lets empty text measure zero width. Extra columns use the bounding column width across all laid-out columns, or the resolved font size when text is empty

orientation: TextOrientation = TextOrientation.Mixed

TextOrientation mode for each character

Throws
IllegalArgumentException

if minColumns or maxColumns is negative, or if minColumns is greater than maxColumns