TextToggleButtonDefaults

object TextToggleButtonDefaults


Contains the default values used by TextToggleButton.

Summary

Public functions

TextToggleButtonShapes

Creates a Shape with a animation between two CornerBasedShapes.

TextToggleButtonShapes

Creates a TextToggleButtonShapes with a static shape.

TextToggleButtonColors

Creates a TextToggleButtonColors for a TextToggleButton

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

Creates a TextToggleButtonColors for a TextToggleButton

TextToggleButtonShapes
@Composable
variantAnimatedShapes(
    unchecked: CornerBasedShape,
    checked: CornerBasedShape,
    pressed: CornerBasedShape
)

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

Public properties

Dp

The default size applied for text toggle buttons.

Dp

The recommended size for an extra large text toggle button.

Dp

The recommended size for a large text toggle button.

CornerBasedShape

Recommended checked Shape for TextToggleButton.

TextStyle

The default text style applied for text toggle buttons.

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.

Public functions

animatedShapes

Added in 1.0.0-alpha29
@Composable
fun animatedShapes(
    shape: CornerBasedShape = TextToggleButtonDefaults.shape,
    pressedShape: CornerBasedShape = TextToggleButtonDefaults.pressedShape
): TextToggleButtonShapes

Creates a Shape with a animation between two CornerBasedShapes.

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 = TextToggleButtonDefaults.shape

The normal shape of the TextToggleButton.

pressedShape: CornerBasedShape = TextToggleButtonDefaults.pressedShape

The pressed shape of the TextToggleButton.

shapes

Added in 1.0.0-alpha29
@Composable
fun shapes(shape: Shape = TextToggleButtonDefaults.shape): TextToggleButtonShapes

Creates a TextToggleButtonShapes with a static shape.

Parameters
shape: Shape = TextToggleButtonDefaults.shape

The normal shape of the TextToggleButton.

textToggleButtonColors

Added in 1.0.0-alpha29
@Composable
fun textToggleButtonColors(): TextToggleButtonColors

Creates a TextToggleButtonColors for a TextToggleButton

textToggleButtonColors

@Composable
fun textToggleButtonColors(
    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

Creates 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

variantAnimatedShapes

Added in 1.0.0-alpha29
@Composable
fun variantAnimatedShapes(
    unchecked: CornerBasedShape = shape,
    checked: CornerBasedShape = checkedShape,
    pressed: CornerBasedShape = pressedShape
): TextToggleButtonShapes

Creates a Shape 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
unchecked: CornerBasedShape = shape

the size of the corner when unchecked.

checked: CornerBasedShape = checkedShape

the size of the corner when checked.

pressed: CornerBasedShape = pressedShape

the size of the corner when pressed.

Public properties

DefaultButtonSize

Added in 1.0.0-alpha29
val DefaultButtonSizeDp

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

ExtraLargeButtonSize

Added in 1.0.0-alpha29
val ExtraLargeButtonSizeDp

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

LargeButtonSize

Added in 1.0.0-alpha29
val LargeButtonSizeDp

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

checkedShape

Added in 1.0.0-alpha29
val checkedShapeCornerBasedShape

Recommended checked Shape for TextToggleButton.

defaultButtonTextStyle

Added in 1.0.0-alpha29
val defaultButtonTextStyleTextStyle

The default text style applied for text toggle buttons.

extraLargeButtonTextStyle

Added in 1.0.0-alpha29
val extraLargeButtonTextStyleTextStyle

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

largeButtonTextStyle

Added in 1.0.0-alpha29
val largeButtonTextStyleTextStyle

The recommended text style for a large text toggle button.

pressedShape

Added in 1.0.0-alpha29
val pressedShapeCornerBasedShape

Recommended pressed Shape for TextToggleButton.

shape

Added in 1.0.0-alpha29
val shapeRoundedCornerShape

Recommended Shape for TextToggleButton.