TextButtonDefaults


object TextButtonDefaults


Contains the default values used by TextButton.

Summary

Public functions

TextButtonColors

Creates a TextButtonColors with the colors for a filled TextButton- by default, a colored background with a contrasting content color.

TextButtonColors
@Composable
filledTextButtonColors(
    containerColor: Color,
    contentColor: Color,
    disabledContainerColor: Color,
    disabledContentColor: Color
)

Creates a TextButtonColors with the colors for a filled TextButton- by default, a colored background with a contrasting content color.

TextButtonColors

Creates a TextButtonColors with the colors for a filled, tonal TextButton- by default, a muted colored background with a contrasting content color.

TextButtonColors
@Composable
filledTonalTextButtonColors(
    containerColor: Color,
    contentColor: Color,
    disabledContainerColor: Color,
    disabledContentColor: Color
)

Creates a TextButtonColors with the colors for a filled, tonal TextButton- by default, a muted colored background with a contrasting content color.

TextButtonColors

Creates a TextButtonColors with the colors for an outlined TextButton- by default, a transparent background with contrasting content color.

TextButtonColors
@Composable
outlinedTextButtonColors(
    contentColor: Color,
    disabledContentColor: Color
)

Creates a TextButtonColors with the colors for an outlined TextButton- by default, a transparent background with contrasting content color.

TextButtonColors
TextButtonColors
@Composable
textButtonColors(
    containerColor: Color,
    contentColor: Color,
    disabledContainerColor: Color,
    disabledContentColor: Color
)

Creates a TextButtonColors for a text button - by default, a transparent background with contrasting content color.

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

Creates a ToggleButtonColors for a TextToggleButton

Public properties

Dp

The default size applied for buttons.

Dp

The recommended size for a large button.

Dp

The recommended size for a small button - for this size, it is recommended to set the text style to Typography.labelMedium.

Shape

Recommended Shape for TextButton.

Public functions

filledTextButtonColors

Added in 1.0.0-alpha21
@Composable
fun filledTextButtonColors(): TextButtonColors

Creates a TextButtonColors with the colors for a filled TextButton- by default, a colored background with a contrasting content color. If the text button is disabled then the colors will default to ColorScheme.onSurface with suitable alpha values applied.

filledTextButtonColors

@Composable
fun filledTextButtonColors(
    containerColor: Color = Color.Unspecified,
    contentColor: Color = Color.Unspecified,
    disabledContainerColor: Color = Color.Unspecified,
    disabledContentColor: Color = Color.Unspecified
): TextButtonColors

Creates a TextButtonColors with the colors for a filled TextButton- by default, a colored background with a contrasting content color. If the text button is disabled then the colors will default to ColorScheme.onSurface with suitable alpha values applied.

Example of TextButton with filledTextButtonColors:

import androidx.wear.compose.material3.ButtonDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextButton
import androidx.wear.compose.material3.TextButtonDefaults

TextButton(
    onClick = { /* Do something */ },
    colors = TextButtonDefaults.filledTextButtonColors()
) {
    Text(text = "ABC")
}
Parameters
containerColor: Color = Color.Unspecified

The background color of this text button when enabled

contentColor: Color = Color.Unspecified

The content color of this text button when enabled

disabledContainerColor: Color = Color.Unspecified

the background color of this text button when not enabled

disabledContentColor: Color = Color.Unspecified

the content color of this text button when not enabled

filledTonalTextButtonColors

Added in 1.0.0-alpha21
@Composable
fun filledTonalTextButtonColors(): TextButtonColors

Creates a TextButtonColors with the colors for a filled, tonal TextButton- by default, a muted colored background with a contrasting content color. If the text button is disabled then the colors will default to ColorScheme.onSurface with suitable alpha values applied.

filledTonalTextButtonColors

@Composable
fun filledTonalTextButtonColors(
    containerColor: Color = Color.Unspecified,
    contentColor: Color = Color.Unspecified,
    disabledContainerColor: Color = Color.Unspecified,
    disabledContentColor: Color = Color.Unspecified
): TextButtonColors

Creates a TextButtonColors with the colors for a filled, tonal TextButton- by default, a muted colored background with a contrasting content color. If the text button is disabled then the colors will default to ColorScheme.onSurface with suitable alpha values applied.

Example of TextButton with filledTonalTextButtonColors:

import androidx.wear.compose.material3.ButtonDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextButton
import androidx.wear.compose.material3.TextButtonDefaults

TextButton(
    onClick = { /* Do something */ },
    colors = TextButtonDefaults.filledTonalTextButtonColors()
) {
    Text(text = "ABC")
}
Parameters
containerColor: Color = Color.Unspecified

The background color of this text button when enabled

contentColor: Color = Color.Unspecified

The content color of this text button when enabled

disabledContainerColor: Color = Color.Unspecified

the background color of this text button when not enabled

disabledContentColor: Color = Color.Unspecified

the content color of this text button when not enabled

outlinedTextButtonColors

Added in 1.0.0-alpha21
@Composable
fun outlinedTextButtonColors(): TextButtonColors

Creates a TextButtonColors with the colors for an outlined TextButton- by default, a transparent background with contrasting content color. If the button is disabled, then the colors will default to ColorScheme.onSurface with suitable alpha values applied.

outlinedTextButtonColors

@Composable
fun outlinedTextButtonColors(
    contentColor: Color = Color.Unspecified,
    disabledContentColor: Color = Color.Unspecified
): TextButtonColors

Creates a TextButtonColors with the colors for an outlined TextButton- by default, a transparent background with contrasting content color. If the button is disabled, then the colors will default to ColorScheme.onSurface with suitable alpha values applied.

Example of TextButton with outlinedTextButtonColors and ButtonDefaults.outlinedButtonBorder:

import androidx.wear.compose.material3.ButtonDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextButton
import androidx.wear.compose.material3.TextButtonDefaults

TextButton(
    onClick = { /* Do something */ },
    colors = TextButtonDefaults.outlinedTextButtonColors(),
    border = ButtonDefaults.outlinedButtonBorder(enabled = true)
) {
    Text(text = "ABC")
}
Parameters
contentColor: Color = Color.Unspecified

The content color of this text button when enabled

disabledContentColor: Color = Color.Unspecified

The content color of this text button when not enabled

textButtonColors

Added in 1.0.0-alpha21
@Composable
fun textButtonColors(): TextButtonColors

textButtonColors

@Composable
fun textButtonColors(
    containerColor: Color = Color.Transparent,
    contentColor: Color = Color.Unspecified,
    disabledContainerColor: Color = Color.Transparent,
    disabledContentColor: Color = Color.Unspecified
): TextButtonColors

Creates a TextButtonColors for a text button - by default, a transparent background with contrasting content color. If the button is disabled then the colors default to ColorScheme.onSurface with suitable alpha values applied.

Parameters
containerColor: Color = Color.Transparent

the background color of this text button when enabled

contentColor: Color = Color.Unspecified

the content color of this text button when enabled

disabledContainerColor: Color = Color.Transparent

the background color of this text button when not enabled

disabledContentColor: Color = Color.Unspecified

the content color of this text button when not enabled

textToggleButtonColors

@Composable
fun textToggleButtonColors(
    checkedContainerColor: Color = TextToggleButtonTokens.CheckedContainerColor.value,
    checkedContentColor: Color = TextToggleButtonTokens.CheckedContentColor.value,
    uncheckedContainerColor: Color = TextToggleButtonTokens.UncheckedContainerColor.value,
    uncheckedContentColor: Color = TextToggleButtonTokens.UncheckedContentColor.value,
    disabledCheckedContainerColor: Color = TextToggleButtonTokens.DisabledCheckedContainerColor.value.toDisabledColor( disabledAlpha = TextToggleButtonTokens.DisabledCheckedContainerOpacity ),
    disabledCheckedContentColor: Color = TextToggleButtonTokens.DisabledCheckedContentColor.value.toDisabledColor( disabledAlpha = TextToggleButtonTokens.DisabledCheckedContentOpacity ),
    disabledUncheckedContainerColor: Color = TextToggleButtonTokens.DisabledUncheckedContainerColor.value.toDisabledColor( disabledAlpha = TextToggleButtonTokens.DisabledUncheckedContainerOpacity ),
    disabledUncheckedContentColor: Color = TextToggleButtonTokens.DisabledUncheckedContentColor.value.toDisabledColor( disabledAlpha = TextToggleButtonTokens.DisabledUncheckedContentOpacity )
): ToggleButtonColors

Creates a ToggleButtonColors for a TextToggleButton

Parameters
checkedContainerColor: Color = TextToggleButtonTokens.CheckedContainerColor.value

the container color of this TextToggleButton when enabled and checked

checkedContentColor: Color = TextToggleButtonTokens.CheckedContentColor.value

the content color of this TextToggleButton when enabled and checked

uncheckedContainerColor: Color = TextToggleButtonTokens.UncheckedContainerColor.value

the container color of this TextToggleButton when enabled and unchecked

uncheckedContentColor: Color = TextToggleButtonTokens.UncheckedContentColor.value

the content color of this TextToggleButton when enabled and unchecked

disabledCheckedContainerColor: Color = TextToggleButtonTokens.DisabledCheckedContainerColor.value.toDisabledColor( disabledAlpha = TextToggleButtonTokens.DisabledCheckedContainerOpacity )

the container color of this TextToggleButton when checked and not enabled

disabledCheckedContentColor: Color = TextToggleButtonTokens.DisabledCheckedContentColor.value.toDisabledColor( disabledAlpha = TextToggleButtonTokens.DisabledCheckedContentOpacity )

the content color of this TextToggleButton when checked and not enabled

disabledUncheckedContainerColor: Color = TextToggleButtonTokens.DisabledUncheckedContainerColor.value.toDisabledColor( disabledAlpha = TextToggleButtonTokens.DisabledUncheckedContainerOpacity )

the container color of this TextToggleButton when unchecked and not enabled

disabledUncheckedContentColor: Color = TextToggleButtonTokens.DisabledUncheckedContentColor.value.toDisabledColor( disabledAlpha = TextToggleButtonTokens.DisabledUncheckedContentOpacity )

the content color of this TextToggleButton when unchecked and not enabled

Public properties

DefaultButtonSize

Added in 1.0.0-alpha21
val DefaultButtonSizeDp

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

LargeButtonSize

Added in 1.0.0-alpha21
val LargeButtonSizeDp

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

SmallButtonSize

Added in 1.0.0-alpha21
val SmallButtonSizeDp

The recommended size for a small button - for this size, it is recommended to set the text style to Typography.labelMedium. It is recommended to apply this size using Modifier.touchTargetAwareSize.

shape

Added in 1.0.0-alpha21
val shapeShape

Recommended Shape for TextButton.