---
title: "ToggleButtonDefaults"
description: "Contains default values used by ToggleButtons."
type: "object"
lastmod: "2026-05-08T01:17:00.921121Z"
---
## API Reference

> Source set: Android

```kotlin
public object ToggleButtonDefaults
```

Contains default values used by [ToggleButton](/jetpack-compose/androidx.xr.glimmer/glimmer/components/ToggleButton)s.

## Properties

### CheckedShape

> Source set: Android

```kotlin
public val CheckedShape: Shape
```

Default shape for [ToggleButton](/jetpack-compose/androidx.xr.glimmer/glimmer/components/ToggleButton) and [IconToggleButton](/jetpack-compose/androidx.xr.glimmer/glimmer/components/IconToggleButton) in the checked state.

## Functions

### contentPadding

```kotlin
@Composable
public fun contentPadding(buttonSize: ButtonSize): PaddingValues
```

Default content padding used for a [ToggleButton](/jetpack-compose/androidx.xr.glimmer/glimmer/components/ToggleButton) with the specified [buttonSize](/jetpack-compose/androidx.xr.glimmer/glimmer/classes/ButtonSize).

### shape

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

Chooses a [Shape](/jetpack-compose/androidx.compose.ui/ui-graphics/interfaces/Shape) based on the [checked](/jetpack-compose/androidx.compose.foundation/foundation/functions/checked) 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 [ToggleButtonDefaults.animateShape](/jetpack-compose/androidx.xr.glimmer/glimmer/objects/ToggleButtonDefaults),
which uses default Glimmer animations and shapes, or consider creating a custom animated
shape.

#### Parameters

| | |
| --- | --- |
| checked | whether the button is in the checked state |
| checkedShape | the shape of the button when it is checked |
| uncheckedShape | the shape of the button when it is unchecked |

### animateShape

```kotlin
@Composable
public fun animateShape(checked: Boolean): Shape
```

Provides a [Shape](/jetpack-compose/androidx.compose.ui/ui-graphics/interfaces/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 | whether the button is in the checked state |

### colors

```kotlin
@Composable
public fun colors(
    backgroundColor: Color = GlimmerTheme.colors.surface,
    checkedBackgroundColor: Color = GlimmerTheme.colors.outline,
    contentColor: Color = calculateContentColor(backgroundColor),
    checkedContentColor: Color = calculateContentColor(checkedBackgroundColor),
): ToggleButtonColors
```

Creates [ToggleButtonColors](/jetpack-compose/androidx.xr.glimmer/glimmer/classes/ToggleButtonColors) with default values for a [ToggleButton](/jetpack-compose/androidx.xr.glimmer/glimmer/components/ToggleButton).

#### Parameters

| | |
| --- | --- |
| backgroundColor | the background color when the button is unchecked |
| checkedBackgroundColor | the background color when the button is checked |
| contentColor | the content color when the button is unchecked |
| checkedContentColor | the content color when the button is checked |
