<div class='sourceset sourceset-common'>Common</div>

```kotlin
value class Trim internal constructor(internal val value: Int)
```

Defines whether to trim the extra space from the top of the first line and the bottom of the
last line of text.

This setting only takes effect when [PlatformParagraphStyle.includeFontPadding](/jetpack-compose/androidx.compose.ui/ui-text/classes/PlatformParagraphStyle) is set to
`false`.

The behavior of [Trim](/jetpack-compose/androidx.compose.ui/ui-text/classes/LineHeightStyle.Trim) depends on the selected [Mode](/jetpack-compose/androidx.compose.ui/ui-text/classes/LineHeightStyle.Mode).

### `Mode.Fixed` (Default), or `Mode.Minimum`
Trims extra vertical space only when the configured line height is *taller* than the font's
default. This prevents clipping of glyphs by ensuring trimming only removes extra space.

### `Mode.Tight`
Trimming is applied even when the configured line height is *shorter* than the font's
default. This offers more aggressive trimming but carries a risk of clipping tall glyphs that
extend beyond the shortened line height.

**Warning:** Use `Mode.Tight` with caution, as it can lead to parts of characters being cut
off. Ensure you have tested your text with various glyphs before using this mode in
production.

## Companion Object

#### Properties

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val FirstLineTop = Trim(FlagTrimTop)
```

Trim the space that would be added to the top of the first line as a result of the
line height. Single line text is both the first and last line. This feature is
available only when [PlatformParagraphStyle.includeFontPadding](/jetpack-compose/androidx.compose.ui/ui-text/classes/PlatformParagraphStyle) is false.

For example, when line height is 3.em, and [Alignment](/jetpack-compose/androidx.compose.ui/ui-text/classes/LineHeightStyle.Alignment) is [Alignment.Center](/jetpack-compose/androidx.compose.ui/ui-geometry/properties/center), the
first line has 2.em height and the height from first line baseline to second line
baseline is still 3.em:
<pre>
+--------+
| Line1  |
|        |
|--------|
|        |
| Line2  |
|        |
+--------+
</pre>

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val LastLineBottom = Trim(FlagTrimBottom)
```

Trim the space that would be added to the bottom of the last line as a result of the
line height. Single line text is both the first and last line. This feature is
available only when [PlatformParagraphStyle.includeFontPadding](/jetpack-compose/androidx.compose.ui/ui-text/classes/PlatformParagraphStyle) is false.

For example, when line height is 3.em, and [Alignment](/jetpack-compose/androidx.compose.ui/ui-text/classes/LineHeightStyle.Alignment) is [Alignment.Center](/jetpack-compose/androidx.compose.ui/ui-geometry/properties/center), the
last line has 2.em height and the height from first line baseline to second line
baseline is still 3.em:
<pre>
+--------+
|        |
| Line1  |
|        |
|--------|
|        |
| Line2  |
+--------+
</pre>

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val Both = Trim(FlagTrimTop or FlagTrimBottom)
```

Trim the space that would be added to the top of the first line and bottom of the
last line as a result of the line height. This feature is available only when
[PlatformParagraphStyle.includeFontPadding](/jetpack-compose/androidx.compose.ui/ui-text/classes/PlatformParagraphStyle) is false.

For example, when line height is 3.em, and [Alignment](/jetpack-compose/androidx.compose.ui/ui-text/classes/LineHeightStyle.Alignment) is [Alignment.Center](/jetpack-compose/androidx.compose.ui/ui-geometry/properties/center), the
first and last line has 2.em height and the height from first line baseline to second
line baseline is still 3.em:
<pre>
+--------+
| Line1  |
|        |
|--------|
|        |
| Line2  |
+--------+
</pre>

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val None = Trim(0)
```

Do not trim first line top or last line bottom.

For example, when line height is 3.em, and [Alignment](/jetpack-compose/androidx.compose.ui/ui-text/classes/LineHeightStyle.Alignment) is [Alignment.Center](/jetpack-compose/androidx.compose.ui/ui-geometry/properties/center), the
first line height, last line height and the height from first line baseline to second
line baseline are 3.em:
<pre>
+--------+
|        |
| Line1  |
|        |
|--------|
|        |
| Line2  |
|        |
+--------+
</pre>