# RepeatButton

## Functions summary

|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/material3/buttons/RepeatButton.composable#RepeatButton(androidx.media3.common.Player,androidx.compose.ui.Modifier,kotlin.collections.List,kotlin.Function1,androidx.compose.ui.unit.Dp,kotlin.Function1,androidx.compose.material3.IconButtonColors,androidx.compose.ui.graphics.Color,kotlin.Function1)( player: https://developer.android.com/reference/kotlin/androidx/media3/common/Player?, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, toggleModeSequence: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.RepeatMode https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>, imageVector: https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState.() -> https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/ImageVector, iconSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, contentDescription: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, colors: https://developer.android.com/reference/kotlin/androidx/compose/material3/IconButtonColors, tint: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, onClick: https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` A Material3 `https://developer.android.com/reference/kotlin/androidx/compose/material3/IconButton.composable#IconButton(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.material3.IconButtonColors,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.graphics.Shape,kotlin.Function0)` that toggles the repeat mode of the player. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/material3/buttons/RepeatButton.composable#RepeatButton(androidx.media3.common.Player,androidx.compose.ui.Modifier,kotlin.collections.List,kotlin.Function1,androidx.compose.ui.unit.Dp,kotlin.Function1,androidx.compose.material3.IconButtonColors,androidx.compose.ui.graphics.Color,kotlin.Function1)( player: https://developer.android.com/reference/kotlin/androidx/media3/common/Player?, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, toggleModeSequence: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.RepeatMode https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>, painter: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState.() -> https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter, iconSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, contentDescription: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, colors: https://developer.android.com/reference/kotlin/androidx/compose/material3/IconButtonColors, tint: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, onClick: https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` A Material3 `https://developer.android.com/reference/kotlin/androidx/compose/material3/IconButton.composable#IconButton(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.material3.IconButtonColors,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.graphics.Shape,kotlin.Function0)` that toggles the repeat mode of the player. |

## Functions

### RepeatButton

Artifact: [androidx.media3:media3-ui-compose-material3](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/ui/compose/material3/buttons/RepeatButton.kt+function:RepeatButton)

```
@UnstableApi
@Composable
fun RepeatButton(
    player: Player?,
    modifier: Modifier = Modifier,
    toggleModeSequence: List<@Player.RepeatMode Int> = listOf(Player.REPEAT_MODE_OFF, Player.REPEAT_MODE_ONE, Player.REPEAT_MODE_ALL),
    imageVector: RepeatButtonState.() -> ImageVector,
    iconSize: Dp = PlayerTokens.MediumIconSize,
    contentDescription: @Composable RepeatButtonState.() -> String = defaultRepeatModeContentDescription,
    colors: IconButtonColors = IconButtonDefaults.iconButtonColors(),
    tint: Color = Color.Unspecified,
    onClick: RepeatButtonState.() -> Unit = RepeatButtonState::onClick
): Unit
```

A Material3 `https://developer.android.com/reference/kotlin/androidx/compose/material3/IconButton.composable#IconButton(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.material3.IconButtonColors,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.graphics.Shape,kotlin.Function0)` that toggles the repeat mode of the player.

When clicked, it cycles through the available repeat modes in the order defined by `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/material3/buttons/package-summary#RepeatButton(androidx.media3.common.Player,androidx.compose.ui.Modifier,kotlin.collections.List,kotlin.Function1,androidx.compose.ui.unit.Dp,kotlin.Function1,androidx.compose.material3.IconButtonColors,androidx.compose.ui.graphics.Color,kotlin.Function1)`. The button's state (e.g., whether it's enabled and the current repeat mode icon) is managed by a `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState` instance derived from the provided `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/material3/buttons/package-summary#RepeatButton(androidx.media3.common.Player,androidx.compose.ui.Modifier,kotlin.collections.List,kotlin.Function1,androidx.compose.ui.unit.Dp,kotlin.Function1,androidx.compose.material3.IconButtonColors,androidx.compose.ui.graphics.Color,kotlin.Function1)`.

| Parameters |
|---|---|
| `player: https://developer.android.com/reference/kotlin/androidx/media3/common/Player?` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Player` to control. |
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | The `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` to be applied to the button. |
| `toggleModeSequence: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.RepeatMode https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html> = listOf(Player.REPEAT_MODE_OFF, Player.REPEAT_MODE_ONE, Player.REPEAT_MODE_ALL)` | The sequence of repeat modes to cycle through when the button is clicked. |
| `imageVector: https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState.() -> https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/ImageVector` | The supplier for `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/ImageVector` used for the icon displayed on the button. This is a composable lambda with `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState` as its receiver, allowing the icon to be updated based on the button's current state (e.g. `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState#repeatModeState()`). |
| `iconSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = PlayerTokens.MediumIconSize` | The size of the icon. |
| `contentDescription: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html = defaultRepeatModeContentDescription` | The content description for accessibility purposes. |
| `colors: https://developer.android.com/reference/kotlin/androidx/compose/material3/IconButtonColors = IconButtonDefaults.iconButtonColors()` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/IconButtonColors` that will be used to resolve the colors used for this icon button in different states. See `https://developer.android.com/reference/kotlin/androidx/compose/material3/IconButtonDefaults#iconButtonColors()`. |
| `tint: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = Color.Unspecified` | Tint to be applied to `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/material3/buttons/package-summary#RepeatButton(androidx.media3.common.Player,androidx.compose.ui.Modifier,kotlin.collections.List,kotlin.Function1,androidx.compose.ui.unit.Dp,kotlin.Function1,androidx.compose.material3.IconButtonColors,androidx.compose.ui.graphics.Color,kotlin.Function1)`. If `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Unspecified()` is provided, then no tint is applied. |
| `onClick: https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html = RepeatButtonState::onClick` | The action to be performed when the button is clicked. This lambda has `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState` as its receiver, providing access to the button's current state (e.g., `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState#isEnabled()`). The default behavior is to call `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState#onClick()`, which updates the `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/material3/buttons/package-summary#RepeatButton(androidx.media3.common.Player,androidx.compose.ui.Modifier,kotlin.collections.List,kotlin.Function1,androidx.compose.ui.unit.Dp,kotlin.Function1,androidx.compose.material3.IconButtonColors,androidx.compose.ui.graphics.Color,kotlin.Function1)` repeat mode. Consumers can customize this behavior: - To add custom logic while still performing the default action, call `this.onClick()` within your lambda. - To completely override the default behavior, implement your custom logic without calling `this.onClick()`. Note that in this case, the button might still be enabled based on the player state, so ensure your custom logic handles cases where modifying the repeat mode is not possible. |

### RepeatButton

Artifact: [androidx.media3:media3-ui-compose-material3](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/ui/compose/material3/buttons/RepeatButton.kt+function:RepeatButton)

```
@UnstableApi
@Composable
fun RepeatButton(
    player: Player?,
    modifier: Modifier = Modifier,
    toggleModeSequence: List<@Player.RepeatMode Int> = listOf(Player.REPEAT_MODE_OFF, Player.REPEAT_MODE_ONE, Player.REPEAT_MODE_ALL),
    painter: @Composable RepeatButtonState.() -> Painter = defaultRepeatModePainterIcon,
    iconSize: Dp = PlayerTokens.MediumIconSize,
    contentDescription: @Composable RepeatButtonState.() -> String = defaultRepeatModeContentDescription,
    colors: IconButtonColors = IconButtonDefaults.iconButtonColors(),
    tint: Color = Color.Unspecified,
    onClick: RepeatButtonState.() -> Unit = RepeatButtonState::onClick
): Unit
```

A Material3 `https://developer.android.com/reference/kotlin/androidx/compose/material3/IconButton.composable#IconButton(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.material3.IconButtonColors,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.graphics.Shape,kotlin.Function0)` that toggles the repeat mode of the player.

When clicked, it cycles through the available repeat modes in the order defined by `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/material3/buttons/package-summary#RepeatButton(androidx.media3.common.Player,androidx.compose.ui.Modifier,kotlin.collections.List,kotlin.Function1,androidx.compose.ui.unit.Dp,kotlin.Function1,androidx.compose.material3.IconButtonColors,androidx.compose.ui.graphics.Color,kotlin.Function1)`. The button's state (e.g., whether it's enabled and the current repeat mode icon) is managed by a `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState` instance derived from the provided `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/material3/buttons/package-summary#RepeatButton(androidx.media3.common.Player,androidx.compose.ui.Modifier,kotlin.collections.List,kotlin.Function1,androidx.compose.ui.unit.Dp,kotlin.Function1,androidx.compose.material3.IconButtonColors,androidx.compose.ui.graphics.Color,kotlin.Function1)`.

| Parameters |
|---|---|
| `player: https://developer.android.com/reference/kotlin/androidx/media3/common/Player?` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Player` to control. |
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | The `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` to be applied to the button. |
| `toggleModeSequence: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.RepeatMode https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html> = listOf(Player.REPEAT_MODE_OFF, Player.REPEAT_MODE_ONE, Player.REPEAT_MODE_ALL)` | The sequence of repeat modes to cycle through when the button is clicked. |
| `painter: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState.() -> https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter = defaultRepeatModePainterIcon` | The supplier for `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` used for the icon displayed on the button. This is a composable lambda with `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState` as its receiver, allowing the icon to be updated based on the button's current state (e.g. `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState#repeatModeState()`). |
| `iconSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = PlayerTokens.MediumIconSize` | The size of the icon. |
| `contentDescription: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html = defaultRepeatModeContentDescription` | The content description for accessibility purposes. |
| `colors: https://developer.android.com/reference/kotlin/androidx/compose/material3/IconButtonColors = IconButtonDefaults.iconButtonColors()` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/IconButtonColors` that will be used to resolve the colors used for this icon button in different states. See `https://developer.android.com/reference/kotlin/androidx/compose/material3/IconButtonDefaults#iconButtonColors()`. |
| `tint: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = Color.Unspecified` | Tint to be applied to `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/material3/buttons/package-summary#RepeatButton(androidx.media3.common.Player,androidx.compose.ui.Modifier,kotlin.collections.List,kotlin.Function1,androidx.compose.ui.unit.Dp,kotlin.Function1,androidx.compose.material3.IconButtonColors,androidx.compose.ui.graphics.Color,kotlin.Function1)`. If `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Unspecified()` is provided, then no tint is applied. |
| `onClick: https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html = RepeatButtonState::onClick` | The action to be performed when the button is clicked. This lambda has `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState` as its receiver, providing access to the button's current state (e.g., `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState#isEnabled()`). The default behavior is to call `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/RepeatButtonState#onClick()`, which updates the `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/material3/buttons/package-summary#RepeatButton(androidx.media3.common.Player,androidx.compose.ui.Modifier,kotlin.collections.List,kotlin.Function1,androidx.compose.ui.unit.Dp,kotlin.Function1,androidx.compose.material3.IconButtonColors,androidx.compose.ui.graphics.Color,kotlin.Function1)` repeat mode. Consumers can customize this behavior: - To add custom logic while still performing the default action, call `this.onClick()` within your lambda. - To completely override the default behavior, implement your custom logic without calling `this.onClick()`. Note that in this case, the button might still be enabled based on the player state, so ensure your custom logic handles cases where modifying the repeat mode is not possible. |