<div class='type'>Interface</div>


<a id='references'></a>

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



```kotlin
@JvmDefaultWithCompatibility
interface Modifier
```


An ordered, immutable collection of `modifier elements` that decorate or add
behavior to Compose UI elements. For example, backgrounds, padding and click event listeners
decorate or add behavior to rows, text or buttons.


Modifier implementations should offer a fluent factory extension function on `Modifier` for
creating combined modifiers by starting from existing modifiers:


Modifier elements may be combined using `then`. Order is significant; modifier elements that
appear first will be applied first.

Composables that accept a `Modifier` as a parameter to be applied to the whole component
represented by the composable function should name the parameter `modifier` and assign the
parameter a default value of `Modifier`. It should appear as the first optional parameter in the
parameter list; after all required parameters (except for trailing lambda parameters) but before
any other parameters with default values. Any default modifiers desired by a composable function
should come after the `modifier` parameter's value in the composable function's implementation,
keeping `Modifier` as the default parameter value. For example:


The pattern above allows default modifiers to still be applied as part of the chain if a caller
also supplies unrelated modifiers.

Composables that accept modifiers to be applied to a specific subcomponent `foo` should name the
parameter `fooModifier` and follow the same guidelines above for default values and behavior.
Subcomponent modifiers should be grouped together and follow the parent composable's modifier.
For example:


## Functions



<h2 id="foldin-initial-operation">foldIn</h2>

```kotlin
fun <R> foldIn(initial: R, operation: (R, Element) -> R): R
```


Accumulates a value starting with `initial` and applying `operation` to the current value and
each element from outside in.

Elements wrap one another in a chain from left to right; an `Element` that appears to the
left of another in a `+` expression or in `operation`'s parameter order affects all of the
elements that appear after it. `foldIn` may be used to accumulate a value starting from the
parent or head of the modifier chain to the final wrapped child.




<hr class="docs-overload-divider">


<h2 id="foldout-initial-operation">foldOut</h2>

```kotlin
fun <R> foldOut(initial: R, operation: (Element, R) -> R): R
```


Accumulates a value starting with `initial` and applying `operation` to the current value and
each element from inside out.

Elements wrap one another in a chain from left to right; an `Element` that appears to the
left of another in a `+` expression or in `operation`'s parameter order affects all of the
elements that appear after it. `foldOut` may be used to accumulate a value starting from the
child or tail of the modifier chain up to the parent or head of the chain.




<hr class="docs-overload-divider">


<h2 id="any-predicate">any</h2>

```kotlin
fun any(predicate: (Element) -> Boolean): Boolean
```


Returns `true` if `predicate` returns true for any `Element` in this `Modifier`.




<hr class="docs-overload-divider">


<h2 id="all-predicate">all</h2>

```kotlin
fun all(predicate: (Element) -> Boolean): Boolean
```


Returns `true` if `predicate` returns true for all `Element`s in this `Modifier` or if this
`Modifier` contains no `Element`s.




<hr class="docs-overload-divider">


<h2 id="then-other">then</h2>

```kotlin
infix fun then(other: Modifier): Modifier
```


Concatenates this modifier with another.

Returns a `Modifier` representing this modifier followed by `other` in sequence.