# IconToggleButtonDefaults

Artifact: [androidx.xr.glimmer:glimmer](https://developer.android.com/jetpack/androidx/releases/xr-glimmer) [View Source](https://cs.android.com/search?q=file:androidx/xr/glimmer/IconToggleButton.kt+class:androidx.xr.glimmer.IconToggleButtonDefaults) Added in [1.0.0-alpha22](https://developer.android.com/jetpack/androidx/releases/xr-glimmer#1.0.0-alpha22)


```
object IconToggleButtonDefaults
```

<br />

*** ** * ** ***

Contains default values used by `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButton.composable#IconToggleButton(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.xr.glimmer.IconToggleButtonColors,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)`s.

## Summary

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#animatedShape(kotlin.Boolean)(checked: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Provides a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape` that uses the default Glimmer shapes for buttons and animates transitions between states. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#checkedBackgroundColor(androidx.compose.ui.graphics.Color)(baseColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color)` Returns the checked, unfocused background `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` for an `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButton.composable#IconToggleButton(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.xr.glimmer.IconToggleButtonColors,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)` derived from the provided `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#checkedBackgroundColor(androidx.compose.ui.graphics.Color)`. |
| `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonColors` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#colors(androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)( backgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, focusedBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, checkedBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, focusedCheckedBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, contentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, focusedContentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, checkedContentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, focusedCheckedContentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color )` Creates `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonColors` with default values for an `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButton.composable#IconToggleButton(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.xr.glimmer.IconToggleButtonColors,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#focusedBackgroundColor(androidx.compose.ui.graphics.Color)(baseColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color)` Returns the unchecked, focused background `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` for an `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButton.composable#IconToggleButton(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.xr.glimmer.IconToggleButtonColors,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)` derived from the provided `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#focusedBackgroundColor(androidx.compose.ui.graphics.Color)`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#focusedCheckedBackgroundColor(androidx.compose.ui.graphics.Color)(baseColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color)` Returns the checked, focused background `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` for an `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButton.composable#IconToggleButton(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.xr.glimmer.IconToggleButtonColors,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)` derived from the provided `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#focusedCheckedBackgroundColor(androidx.compose.ui.graphics.Color)`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#shape(kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Shape)(checked: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, checkedShape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape, uncheckedShape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape)` Chooses a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape` based on the `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#shape(kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Shape)` state and can be used to override the default Glimmer button shapes. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape` | `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#CheckedShape()` Default shape for `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButton.composable#IconToggleButton(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.xr.glimmer.IconToggleButtonColors,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)` in the checked state. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/PaddingValues` | `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#contentPadding()` Default content padding used for an `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButton.composable#IconToggleButton(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.xr.glimmer.IconToggleButtonColors,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)`. |

## Public functions

### animatedShape

Added in [1.0.0-alpha22](https://developer.android.com/jetpack/androidx/releases/xr-glimmer#1.0.0-alpha22)

```
@Composable
fun animatedShape(checked: Boolean): Shape
```

Provides a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape` that uses the default Glimmer shapes for buttons and animates transitions between states. If you require an animated transition between your own custom shapes, please consider creating a custom animated shape.

| Parameters |
|---|---|
| `checked: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the button is in the checked state |

### checkedBackgroundColor

Added in [1.0.0-alpha22](https://developer.android.com/jetpack/androidx/releases/xr-glimmer#1.0.0-alpha22)

```
@Composable
fun checkedBackgroundColor(baseColor: Color = GlimmerTheme.colors.primary): Color
```

Returns the checked, unfocused background `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` for an `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButton.composable#IconToggleButton(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.xr.glimmer.IconToggleButtonColors,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)` derived from the provided `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#checkedBackgroundColor(androidx.compose.ui.graphics.Color)`.

`https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#checkedBackgroundColor(androidx.compose.ui.graphics.Color)` is not the final color. It is a brand or accent color, which is adjusted to a tone that is suitable for use as a checked background.

| Parameters |
|---|---|
| `baseColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = GlimmerTheme.colors.primary` | the brand or accent `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` to derive from, such as `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/Colors#primary()` |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | the background `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` for the button when checked and unfocused |

### colors

Added in [1.0.0-alpha22](https://developer.android.com/jetpack/androidx/releases/xr-glimmer#1.0.0-alpha22)

```
@Composable
fun colors(
    backgroundColor: Color = GlimmerTheme.colors.surface,
    focusedBackgroundColor: Color = focusedBackgroundColor(backgroundColor),
    checkedBackgroundColor: Color = checkedBackgroundColor(),
    focusedCheckedBackgroundColor: Color = focusedCheckedBackgroundColor(checkedBackgroundColor),
    contentColor: Color = calculateContentColor(backgroundColor),
    focusedContentColor: Color = calculateContentColor(focusedBackgroundColor),
    checkedContentColor: Color = calculateContentColor(checkedBackgroundColor),
    focusedCheckedContentColor: Color = calculateContentColor(focusedCheckedBackgroundColor)
): IconToggleButtonColors
```

Creates `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonColors` with default values for an `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButton.composable#IconToggleButton(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.xr.glimmer.IconToggleButtonColors,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)`.

| Parameters |
|---|---|
| `backgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = GlimmerTheme.colors.surface` | the background color when the button is unchecked and unfocused |
| `focusedBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = focusedBackgroundColor(backgroundColor)` | the background color when the button is unchecked and focused |
| `checkedBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = checkedBackgroundColor()` | the background color when the button is checked and unfocused |
| `focusedCheckedBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = focusedCheckedBackgroundColor(checkedBackgroundColor)` | the background color when the button is checked and focused. Defaults to a color derived from `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#colors(androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)` |
| `contentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = calculateContentColor(backgroundColor)` | the content color when the button is unchecked and unfocused |
| `focusedContentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = calculateContentColor(focusedBackgroundColor)` | the content color when the button is unchecked and focused |
| `checkedContentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = calculateContentColor(checkedBackgroundColor)` | the content color when the button is checked and unfocused |
| `focusedCheckedContentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = calculateContentColor(focusedCheckedBackgroundColor)` | the content color when the button is checked and focused |

### focusedBackgroundColor

Added in [1.0.0-alpha22](https://developer.android.com/jetpack/androidx/releases/xr-glimmer#1.0.0-alpha22)

```
@Composable
fun focusedBackgroundColor(baseColor: Color = GlimmerTheme.colors.surface): Color
```

Returns the unchecked, focused background `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` for an `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButton.composable#IconToggleButton(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.xr.glimmer.IconToggleButtonColors,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)` derived from the provided `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#focusedBackgroundColor(androidx.compose.ui.graphics.Color)`.

`https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#focusedBackgroundColor(androidx.compose.ui.graphics.Color)` is not the final color. It is the unchecked, unfocused background color of the button, which is adjusted so that it is suitable for use as a focused background.

| Parameters |
|---|---|
| `baseColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = GlimmerTheme.colors.surface` | the unchecked, unfocused background `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` of the button, such as `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/Colors#surface()` or a custom background color |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | the background `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` for the button when unchecked and focused |

### focusedCheckedBackgroundColor

Added in [1.0.0-alpha22](https://developer.android.com/jetpack/androidx/releases/xr-glimmer#1.0.0-alpha22)

```
@Composable
fun focusedCheckedBackgroundColor(
    baseColor: Color = GlimmerTheme.colors.primary
): Color
```

Returns the checked, focused background `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` for an `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButton.composable#IconToggleButton(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.xr.glimmer.IconToggleButtonColors,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)` derived from the provided `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#focusedCheckedBackgroundColor(androidx.compose.ui.graphics.Color)`.

`https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#focusedCheckedBackgroundColor(androidx.compose.ui.graphics.Color)` is not the final color. It is the same brand or accent color passed to `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#checkedBackgroundColor(androidx.compose.ui.graphics.Color)`, which is adjusted to a tone that is suitable for use as a checked, focused background.

| Parameters |
|---|---|
| `baseColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = GlimmerTheme.colors.primary` | the brand or accent `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` to derive from, such as `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/Colors#primary()` |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | the background `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` for the button when checked and focused |

### shape

Added in [1.0.0-alpha22](https://developer.android.com/jetpack/androidx/releases/xr-glimmer#1.0.0-alpha22)

```
@Composable
fun shape(
    checked: Boolean,
    checkedShape: Shape = CheckedShape,
    uncheckedShape: Shape = GlimmerTheme.shapes.large
): Shape
```

Chooses a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape` based on the `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#shape(kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Shape)` state and can be used to override the default Glimmer button shapes. Note that it simply switches shapes without animation.

If you require an animated version, please refer to `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButtonDefaults#animatedShape(kotlin.Boolean)`, which uses default Glimmer animations and shapes, or consider creating a custom animated shape.

| Parameters |
|---|---|
| `checked: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether the button is in the checked state |
| `checkedShape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape = CheckedShape` | the shape of the button when it is checked |
| `uncheckedShape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape = GlimmerTheme.shapes.large` | the shape of the button when it is unchecked |

## Public properties

### CheckedShape

Added in [1.0.0-alpha22](https://developer.android.com/jetpack/androidx/releases/xr-glimmer#1.0.0-alpha22)

```
val CheckedShape: Shape
```

Default shape for `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButton.composable#IconToggleButton(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.xr.glimmer.IconToggleButtonColors,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)` in the checked state.

### contentPadding

```
val contentPadding: PaddingValues
```

Default content padding used for an `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/IconToggleButton.composable#IconToggleButton(kotlin.Boolean,kotlin.Function1,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.xr.glimmer.IconToggleButtonColors,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)`.