TextToggleButtonDefaults

object TextToggleButtonDefaults


Contains the default values used by TextToggleButton.

Summary

Public functions

TextToggleButtonShapes

Returns the default TextToggleButtonShapes with an animation between two CornerBasedShapes when pressed.

TextToggleButtonShapes

Returns a TextToggleButtonShapes with an animation between two CornerBasedShapes when pressed.

TextToggleButtonColors

Returns a TextToggleButtonColors for a TextToggleButton

TextToggleButtonColors
@Composable
colors(
    checkedContainerColor: Color,
    checkedContentColor: Color,
    uncheckedContainerColor: Color,
    uncheckedContentColor: Color,
    disabledCheckedContainerColor: Color,
    disabledCheckedContentColor: Color,
    disabledUncheckedContainerColor: Color,
    disabledUncheckedContentColor: Color
)

Returns a TextToggleButtonColors for a TextToggleButton

TextToggleButtonShapes

Returns the default TextToggleButtonShapes for a TextToggleButton with a static shape.

TextToggleButtonShapes

Returns a TextToggleButtonShapes for a TextToggleButton with a static shape.

TextToggleButtonShapes

Returns the default TextToggleButtonShapes with an animation between three CornerSizes based on the pressed state and checked/unchecked.

TextToggleButtonShapes
@Composable
variantAnimatedShapes(
    uncheckedShape: CornerBasedShape?,
    checkedShape: CornerBasedShape?
)

Returns a TextToggleButtonShapes with an animation between three CornerSizes based on the pressed state and checked/unchecked.

Public properties

Dp

The recommended size for an extra large text toggle button.

Dp

The recommended size for a large text toggle button.

Dp

The default size applied for text toggle buttons.

CornerBasedShape

Recommended checked Shape for TextToggleButton.

TextStyle

The recommended text style for an extra large text toggle button.

TextStyle

The recommended text style for a large text toggle button.

CornerBasedShape

Recommended pressed Shape for TextToggleButton.

RoundedCornerShape

Recommended Shape for TextToggleButton.

TextStyle

The default text style applied for text toggle buttons.

Public functions

animatedShapes

Added in 1.0.0-alpha33
@Composable
fun animatedShapes(): TextToggleButtonShapes

Returns the default TextToggleButtonShapes with an animation between two CornerBasedShapes when pressed.

A simple text toggle button using the default colors, animated when pressed.

import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextToggleButton
import androidx.wear.compose.material3.TextToggleButtonDefaults

var checked by remember { mutableStateOf(true) }
TextToggleButton(
    checked = checked,
    onCheckedChange = { checked = !checked },
    shapes = TextToggleButtonDefaults.animatedShapes(),
) {
    Text(text = if (checked) "On" else "Off")
}

animatedShapes

Added in 1.0.0-alpha33
@Composable
fun animatedShapes(
    shape: CornerBasedShape? = null,
    pressedShape: CornerBasedShape? = null
): TextToggleButtonShapes

Returns a TextToggleButtonShapes with an animation between two CornerBasedShapes when pressed.

A simple text toggle button using the default colors, animated when pressed.

import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextToggleButton
import androidx.wear.compose.material3.TextToggleButtonDefaults

var checked by remember { mutableStateOf(true) }
TextToggleButton(
    checked = checked,
    onCheckedChange = { checked = !checked },
    shapes = TextToggleButtonDefaults.animatedShapes(),
) {
    Text(text = if (checked) "On" else "Off")
}
Parameters
shape: CornerBasedShape? = null

The normal shape of the TextToggleButton - if null, the default TextToggleButtonDefaults.shape is used.

pressedShape: CornerBasedShape? = null

The pressed shape of the TextToggleButton if null, the default TextToggleButtonDefaults.pressedShape is used.

colors

Added in 1.0.0-alpha33
@Composable
fun colors(): TextToggleButtonColors

Returns a TextToggleButtonColors for a TextToggleButton

colors

@Composable
fun colors(
    checkedContainerColor: Color = Color.Unspecified,
    checkedContentColor: Color = Color.Unspecified,
    uncheckedContainerColor: Color = Color.Unspecified,
    uncheckedContentColor: Color = Color.Unspecified,
    disabledCheckedContainerColor: Color = Color.Unspecified,
    disabledCheckedContentColor: Color = Color.Unspecified,
    disabledUncheckedContainerColor: Color = Color.Unspecified,
    disabledUncheckedContentColor: Color = Color.Unspecified
): TextToggleButtonColors

Returns a TextToggleButtonColors for a TextToggleButton

Parameters
checkedContainerColor: Color = Color.Unspecified

the container color of this TextToggleButton when enabled and checked

checkedContentColor: Color = Color.Unspecified

the content color of this TextToggleButton when enabled and checked

uncheckedContainerColor: Color = Color.Unspecified

the container color of this TextToggleButton when enabled and unchecked

uncheckedContentColor: Color = Color.Unspecified

the content color of this TextToggleButton when enabled and unchecked

disabledCheckedContainerColor: Color = Color.Unspecified

the container color of this TextToggleButton when checked and not enabled

disabledCheckedContentColor: Color = Color.Unspecified

the content color of this TextToggleButton when checked and not enabled

disabledUncheckedContainerColor: Color = Color.Unspecified

the container color of this TextToggleButton when unchecked and not enabled

disabledUncheckedContentColor: Color = Color.Unspecified

the content color of this TextToggleButton when unchecked and not enabled

shapes

Added in 1.0.0-alpha33
@Composable
fun shapes(): TextToggleButtonShapes

Returns the default TextToggleButtonShapes for a TextToggleButton with a static shape.

shapes

Added in 1.0.0-alpha33
@Composable
fun shapes(shape: Shape): TextToggleButtonShapes

Returns a TextToggleButtonShapes for a TextToggleButton with a static shape.

Parameters
shape: Shape

The normal shape of the TextToggleButton.

variantAnimatedShapes

Added in 1.0.0-alpha33
@Composable
fun variantAnimatedShapes(): TextToggleButtonShapes

Returns the default TextToggleButtonShapes with an animation between three CornerSizes based on the pressed state and checked/unchecked.

A simple text toggle button using the default colors, animated on Press and Check/Uncheck:

import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextToggleButton
import androidx.wear.compose.material3.TextToggleButtonDefaults

var checked by remember { mutableStateOf(true) }
TextToggleButton(
    checked = checked,
    onCheckedChange = { checked = !checked },
    shapes = TextToggleButtonDefaults.variantAnimatedShapes()
) {
    Text(text = if (checked) "On" else "Off")
}

variantAnimatedShapes

Added in 1.0.0-alpha33
@Composable
fun variantAnimatedShapes(
    uncheckedShape: CornerBasedShape? = null,
    checkedShape: CornerBasedShape? = null
): TextToggleButtonShapes

Returns a TextToggleButtonShapes with an animation between three CornerSizes based on the pressed state and checked/unchecked.

A simple text toggle button using the default colors, animated on Press and Check/Uncheck:

import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextToggleButton
import androidx.wear.compose.material3.TextToggleButtonDefaults

var checked by remember { mutableStateOf(true) }
TextToggleButton(
    checked = checked,
    onCheckedChange = { checked = !checked },
    shapes = TextToggleButtonDefaults.variantAnimatedShapes()
) {
    Text(text = if (checked) "On" else "Off")
}
Parameters
uncheckedShape: CornerBasedShape? = null

the unchecked shape - if null, the default TextToggleButtonDefaults.shape is used.

checkedShape: CornerBasedShape? = null

the checked shape - if null, the default TextToggleButtonDefaults.checkedShape is used.

Public properties

ExtraLargeSize

Added in 1.0.0-alpha33
val ExtraLargeSizeDp

The recommended size for an extra large text toggle button. It is recommended to apply this size using Modifier.touchTargetAwareSize.

LargeSize

Added in 1.0.0-alpha33
val LargeSizeDp

The recommended size for a large text toggle button. It is recommended to apply this size using Modifier.touchTargetAwareSize.

Size

Added in 1.0.0-alpha33
val SizeDp

The default size applied for text toggle buttons. It is recommended to apply this size using Modifier.touchTargetAwareSize.

checkedShape

Added in 1.0.0-alpha33
val checkedShapeCornerBasedShape

Recommended checked Shape for TextToggleButton.

extraLargeTextStyle

Added in 1.0.0-alpha33
val extraLargeTextStyleTextStyle

The recommended text style for an extra large text toggle button.

largeTextStyle

Added in 1.0.0-alpha33
val largeTextStyleTextStyle

The recommended text style for a large text toggle button.

pressedShape

Added in 1.0.0-alpha33
val pressedShapeCornerBasedShape

Recommended pressed Shape for TextToggleButton.

shape

Added in 1.0.0-alpha33
val shapeRoundedCornerShape

Recommended Shape for TextToggleButton.

textStyle

Added in 1.0.0-alpha33
val textStyleTextStyle

The default text style applied for text toggle buttons.