# StyleStateScope

Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleScope.kt+class:androidx.compose.foundation.style.StyleStateScope) Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.12.0) Common/All
- Cmn

  ```
  @ExperimentalFoundationStyleApi
  interface StyleStateScope
  ```
Known direct subclasses [CommonStyleScope](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/CommonStyleScope), [StyleScope](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleScope)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/CommonStyleScope` | A `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/CommonStyleScope` is the scope used by a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/CommonStyle`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleScope` | A `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleScope` is the receiver scope of a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` lambda. |

*** ** * ** ***

An interface that introduces the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope#state(androidx.compose.foundation.style.StyleStateKey,kotlin.Function0,kotlin.Function2)` property to a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` receiver scope.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleScope` |   |

## Summary

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope#state(androidx.compose.foundation.style.StyleStateKey,kotlin.Function0,kotlin.Function2)( key: https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateKey<T>, block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, active: (key: https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateKey<T>, state: https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` A helper function to implement state reading extension functions such as `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).pressed(kotlin.Function0)`. | Cmn |

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope#state()` The state of the component. applying this style. | Cmn |

| ### Extension functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope#(androidx.compose.foundation.style.StyleStateScope).state(androidx.compose.foundation.style.StyleStateKey,kotlin.Function0)(key: https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateKey<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html>, block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` A helper function to implement state reading extension functions such as `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).pressed(kotlin.Function0)` for use with `Boolean` states. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope#(androidx.compose.foundation.style.StyleStateScope).checked(kotlin.Function0)(block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#isChecked()` is `true`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope#(androidx.compose.foundation.style.StyleStateScope).disabled(kotlin.Function0)(block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is disabled. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope#(androidx.compose.foundation.style.StyleStateScope).focused(kotlin.Function0)(block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is focused. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope#(androidx.compose.foundation.style.StyleStateScope).hovered(kotlin.Function0)(block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is hovered. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope#(androidx.compose.foundation.style.StyleStateScope).pressed(kotlin.Function0)(block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is pressed. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope#(androidx.compose.foundation.style.StyleStateScope).selected(kotlin.Function0)(block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#isSelected()` is `true`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope#(androidx.compose.foundation.style.StyleStateScope).triStateToggleIndeterminate(kotlin.Function0)(block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#triStateToggle()` is `https://developer.android.com/reference/kotlin/androidx/compose/ui/state/ToggleableState#Indeterminate`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope#(androidx.compose.foundation.style.StyleStateScope).triStateToggleOff(kotlin.Function0)(block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#triStateToggle()` is `https://developer.android.com/reference/kotlin/androidx/compose/ui/state/ToggleableState#Off`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope#(androidx.compose.foundation.style.StyleStateScope).triStateToggleOn(kotlin.Function0)(block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#triStateToggle()` is `https://developer.android.com/reference/kotlin/androidx/compose/ui/state/ToggleableState#On`. | Cmn |

## Public functions

### state

Cmn Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.12.0)

```
fun <T : Any?> state(
    key: StyleStateKey<T>,
    block: () -> Unit,
    active: (key: StyleStateKey<T>, state: StyleState) -> Boolean
): Unit
```

A helper function to implement state reading extension functions such as `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).pressed(kotlin.Function0)`.

Custom style states can use this function to implement start reading functions to be consistent with the predefined state reading functions.

```kotlin
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.style.CustomStyle
import androidx.compose.foundation.style.Style
import androidx.compose.foundation.style.StyleScope
import androidx.compose.foundation.style.StyleStateKey
import androidx.compose.foundation.style.rememberUpdatedStyleState
import androidx.compose.foundation.style.state
import androidx.compose.foundation.style.styleable
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color

// Create a new StyleStateKey
val playingStateKey = StyleStateKey(false)

// In the module scope are the following declarations:
//
//    // A custom style scope which has all the properties of StyleScope
//    interface MediaPlayerStyleScope : StyleScope
//
//    // A custom style type
//    fun interface MediaPlayerStyle : CustomStyle<MediaPlayerStyleScope> {
//        companion object : MediaPlayerStyle {
//            override fun MediaPlayerStyleScope.applyStyle() { }
//        }
//    }

// Introduce a function to convert the custom style to a Style
fun MediaPlayerStyle.toStyle(): Style = Style {
    val scope = object : StyleScope by this, MediaPlayerStyleScope {}
    with(scope) { applyStyle() }
}

// Introduce an extension function to read the style state. This will only be
// available in a MediaPlayerStyle.
fun MediaPlayerStyleScope.playerPlaying(block: () -> Unit) {
    state(playingStateKey, block)
}

// The MediaPlayer composable
@Suppress("UNUSED_PARAMETER")
@Composable
fun MediaPlayer(
    url: String,
    modifier: Modifier = Modifier,
    style: MediaPlayerStyle = MediaPlayerStyle,
    playing: Boolean = true,
) {
    val styleState =
        rememberUpdatedStyleState(null) { state -> state[playingStateKey] = playing }
    Box(modifier = modifier.styleable(styleState, style.toStyle())) {
        // Implementation of the media player
    }
}

// Using the style in a composable that sets the state.
MediaPlayer(
    url = "https://example.com/media/video",
    style = {
        borderColor(Color.Gray)

        // This only sets the border color to green when the media player is playing
        playerPlaying { borderColor(Color.Green) }
    },
)
```

| Parameters |
|---|---|
| `key: https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateKey<T>` | the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateKey` for the custom state. |
| `block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | the block to execute when `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope#state(androidx.compose.foundation.style.StyleStateKey,kotlin.Function0,kotlin.Function2)` returns `true`. |
| `active: (key: https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateKey<T>, state: https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | an expression that should return `true` when the state is active and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateScope#state(androidx.compose.foundation.style.StyleStateKey,kotlin.Function0,kotlin.Function2)` should be called. |

## Public properties

### state

Cmn Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.12.0)

```
val state: StyleState
```

The state of the component. applying this style. For example, if a component is pressed the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#isPressed()` will be `true`.

Custom states can be read from the state using the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateKey` for the state.

## Extension functions

### StyleStateScope.state

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleScope.kt+function:state)

```
@ExperimentalFoundationStyleApi
fun StyleStateScope.state(key: StyleStateKey<Boolean>, block: () -> Unit): Unit
```

A helper function to implement state reading extension functions such as `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).pressed(kotlin.Function0)` for use with `Boolean` states.

Custom style states can use this function to implement start reading functions to be consistent with the predefined state reading functions.

```kotlin
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.style.CustomStyle
import androidx.compose.foundation.style.Style
import androidx.compose.foundation.style.StyleScope
import androidx.compose.foundation.style.StyleStateKey
import androidx.compose.foundation.style.rememberUpdatedStyleState
import androidx.compose.foundation.style.state
import androidx.compose.foundation.style.styleable
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color

// Create a new StyleStateKey
val playingStateKey = StyleStateKey(false)

// In the module scope are the following declarations:
//
//    // A custom style scope which has all the properties of StyleScope
//    interface MediaPlayerStyleScope : StyleScope
//
//    // A custom style type
//    fun interface MediaPlayerStyle : CustomStyle<MediaPlayerStyleScope> {
//        companion object : MediaPlayerStyle {
//            override fun MediaPlayerStyleScope.applyStyle() { }
//        }
//    }

// Introduce a function to convert the custom style to a Style
fun MediaPlayerStyle.toStyle(): Style = Style {
    val scope = object : StyleScope by this, MediaPlayerStyleScope {}
    with(scope) { applyStyle() }
}

// Introduce an extension function to read the style state. This will only be
// available in a MediaPlayerStyle.
fun MediaPlayerStyleScope.playerPlaying(block: () -> Unit) {
    state(playingStateKey, block)
}

// The MediaPlayer composable
@Suppress("UNUSED_PARAMETER")
@Composable
fun MediaPlayer(
    url: String,
    modifier: Modifier = Modifier,
    style: MediaPlayerStyle = MediaPlayerStyle,
    playing: Boolean = true,
) {
    val styleState =
        rememberUpdatedStyleState(null) { state -> state[playingStateKey] = playing }
    Box(modifier = modifier.styleable(styleState, style.toStyle())) {
        // Implementation of the media player
    }
}

// Using the style in a composable that sets the state.
MediaPlayer(
    url = "https://example.com/media/video",
    style = {
        borderColor(Color.Gray)

        // This only sets the border color to green when the media player is playing
        playerPlaying { borderColor(Color.Green) }
    },
)
```

| Parameters |
|---|---|
| `key: https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateKey<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html>` | the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleStateKey` for the custom state. |
| `block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | the block to execute when the style state is `true`. |

### StyleStateScope.checked

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleState.kt+function:checked)

```
@ExperimentalFoundationStyleApi
fun StyleStateScope.checked(block: () -> Unit): Unit
```

Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#isChecked()` is `true`. The properties within the provided `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).checked(kotlin.Function0)` will override or merge with the base style of the component when a toggle interaction is detected.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#isChecked()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).focused(kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).hovered(kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).pressed(kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).selected(kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/selection/toggleable.modifier#(androidx.compose.ui.Modifier).toggleable(kotlin.Boolean,kotlin.Boolean,androidx.compose.ui.semantics.Role,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function1)` |   |

### StyleStateScope.disabled

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleState.kt+function:disabled)

```
@ExperimentalFoundationStyleApi
fun StyleStateScope.disabled(block: () -> Unit): Unit
```

Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is disabled. The properties within the provided `value` Style will override or merge with the base style of the component when the style state for the component is disabled.

| Parameters |
|---|---|
| `block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to apply on hover. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#isEnabled()` |   |

### StyleStateScope.focused

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleState.kt+function:focused)

```
@ExperimentalFoundationStyleApi
fun StyleStateScope.focused(block: () -> Unit): Unit
```

Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is focused. The properties within the provided `value` Style will override or merge with the base style of the component when a focus interaction is detected.

| Parameters |
|---|---|
| `block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to apply on focus. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#isFocused()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).checked(kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).hovered(kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).pressed(kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).selected(kotlin.Function0)` |   |

### StyleStateScope.hovered

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleState.kt+function:hovered)

```
@ExperimentalFoundationStyleApi
fun StyleStateScope.hovered(block: () -> Unit): Unit
```

Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is hovered. The properties within the provided `value` Style will override or merge with the base style of the component when a hover interaction is detected.

| Parameters |
|---|---|
| `block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to apply on hover. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#isHovered()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).checked(kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).focused(kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).pressed(kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).selected(kotlin.Function0)` |   |

### StyleStateScope.pressed

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleState.kt+function:pressed)

```
@ExperimentalFoundationStyleApi
fun StyleStateScope.pressed(block: () -> Unit): Unit
```

Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is pressed. The properties within the provided `value` Style will override or merge with the base style of the component when a press interaction is detected.

| Parameters |
|---|---|
| `block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to apply on press. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#isPressed()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).checked(kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).focused(kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).hovered(kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).selected(kotlin.Function0)` |   |

### StyleStateScope.selected

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleState.kt+function:selected)

```
@ExperimentalFoundationStyleApi
fun StyleStateScope.selected(block: () -> Unit): Unit
```

Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#isSelected()` is `true`. The properties within the provided `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).selected(kotlin.Function0)` Style will override or merge with the base style of the component when a toggle interaction is detected.

| Parameters |
|---|---|
| `block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to apply on press. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#isSelected()` |   |

### StyleStateScope.triStateToggleIndeterminate

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleState.kt+function:triStateToggleIndeterminate)

```
@ExperimentalFoundationStyleApi
fun StyleStateScope.triStateToggleIndeterminate(block: () -> Unit): Unit
```

Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#triStateToggle()` is `https://developer.android.com/reference/kotlin/androidx/compose/ui/state/ToggleableState#Indeterminate`. The properties within the provided `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).triStateToggleIndeterminate(kotlin.Function0)` Style will override or merge with the base style of the component when a toggle interaction is detected.

| Parameters |
|---|---|
| `block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to apply on press. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#triStateToggle()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/selection/triStateToggleable.modifier#(androidx.compose.ui.Modifier).triStateToggleable(androidx.compose.ui.state.ToggleableState,kotlin.Boolean,androidx.compose.ui.semantics.Role,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)` |   |

### StyleStateScope.triStateToggleOff

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleState.kt+function:triStateToggleOff)

```
@ExperimentalFoundationStyleApi
fun StyleStateScope.triStateToggleOff(block: () -> Unit): Unit
```

Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#triStateToggle()` is `https://developer.android.com/reference/kotlin/androidx/compose/ui/state/ToggleableState#Off`. The properties within the provided `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).triStateToggleOff(kotlin.Function0)` Style will override or merge with the base style of the component when a toggle interaction is detected.

| Parameters |
|---|---|
| `block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to apply on press. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#triStateToggle()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/selection/triStateToggleable.modifier#(androidx.compose.ui.Modifier).triStateToggleable(androidx.compose.ui.state.ToggleableState,kotlin.Boolean,androidx.compose.ui.semantics.Role,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)` |   |

### StyleStateScope.triStateToggleOn

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleState.kt+function:triStateToggleOn)

```
@ExperimentalFoundationStyleApi
fun StyleStateScope.triStateToggleOn(block: () -> Unit): Unit
```

Defines a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to be applied when the component is `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#triStateToggle()` is `https://developer.android.com/reference/kotlin/androidx/compose/ui/state/ToggleableState#On`. The properties within the provided `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.StyleStateScope).triStateToggleOn(kotlin.Function0)` Style will override or merge with the base style of the component when a toggle interaction is detected.

| Parameters |
|---|---|
| `block: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` to apply on press. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleState#triStateToggle()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/selection/triStateToggleable.modifier#(androidx.compose.ui.Modifier).triStateToggleable(androidx.compose.ui.state.ToggleableState,kotlin.Boolean,androidx.compose.ui.semantics.Role,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)` |   |