TextOverflow

Class

Common
value class TextOverflow internal constructor(internal val value: Int)

How overflowing text should be handled.

Companion Object

Properties

Common
val Clip = TextOverflow(1)

Clip the overflowing text to fix its container.

Common
val Ellipsis = TextOverflow(2)

Use an ellipsis at the end of the string to indicate that the text has overflowed.

For example, This is a ....

Common
val Visible = TextOverflow(3)

Display all text, even if there is not enough space in the specified bounds. When overflow is visible, text may be rendered outside the bounds of the composable displaying the text. This ensures that all text is displayed to the user, and is typically the right choice for most text display. It does mean that the text may visually occupy a region larger than the bounds of it's composable. This can lead to situations where text displays outside the bounds of the background and clickable on a Text composable with a fixed height and width.

To make the background and click region expand to match the size of the text, allow it to expand vertically/horizontally using Modifier.heightIn/Modifier.widthIn or similar.

Note: text that expands past its bounds using Visible may be clipped by other modifiers such as Modifier.clipToBounds.

Common
val StartEllipsis = TextOverflow(4)

Use an ellipsis at the start of the string to indicate that the text has overflowed.

For example, ... is a text.

Note that not all platforms support the ellipsis at the start. For example, on Android the start ellipsis is only available for a single line text (i.e. when either a soft wrap is disabled or a maximum number of lines maxLines set to 1). In case of multiline text it will fallback to Clip.

Common
val MiddleEllipsis = TextOverflow(5)

Use an ellipsis in the middle of the string to indicate that the text has overflowed.

For example, This ... text.

Note that not all platforms support the ellipsis in the middle. For example, on Android the middle ellipsis is only available for a single line text (i.e. when either a soft wrap is disabled or a maximum number of lines maxLines set to 1). In case of multiline text it will fallback to Clip.