State of Compose 2023 results are in! Click here to learn more

← Back to Tv Material

Button

Component
in
Tv Material
. Since 1.0.0-alpha07

Overview

Code Examples

Video

Material Design filled button for TV.

Filled buttons are for high emphasis (important, final actions that complete a flow).

Choose the best button for an action based on the amount of emphasis it needs. The more important an action is, the higher emphasis its button should be.

  • See Button for high emphasis (important, final actions that complete a flow).
  • See OutlinedButton for a medium-emphasis button with a border.

The default text style for internal Text components will be set to Typography.labelLarge.

@param onClick called when this button is clicked @param modifier the Modifier to be applied to this button @param enabled controls the enabled state of this button. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services. @param scale Defines size of the Button relative to its original size. @param glow Shadow to be shown behind the Button. @param shape Defines the Button's shape. @param colors Color to be used for background and content of the Button @param tonalElevation tonal elevation used to apply a color shift to the button to give the it higher emphasis @param border Defines a border around the Button. @param contentPadding the spacing values to apply internally between the container and the content @param interactionSource the MutableInteractionSource representing the stream of Interactions for this button. You can create and pass in your own remembered instance to observe Interactions and customize the appearance / behavior of this button in different states. @param content the content of the button

Overloads

Button

@ExperimentalTvMaterial3Api
@NonRestartableComposable
@Composable
fun Button(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    scale: ButtonScale = ButtonDefaults.scale(),
    glow: ButtonGlow = ButtonDefaults.glow(),
    shape: ButtonShape = ButtonDefaults.shape(),
    colors: ButtonColors = ButtonDefaults.colors(),
    tonalElevation: Dp = Elevation.Level0,
    border: ButtonBorder = ButtonDefaults.border(),
    contentPadding: PaddingValues = ButtonDefaults.ContentPadding,
    interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
    content: @Composable RowScope.() -> Unit
)

Parameters

NameDescription
onClickcalled when this button is clicked
modifierthe Modifier to be applied to this button
enabledcontrols the enabled state of this button. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.
scaleDefines size of the Button relative to its original size.
glowShadow to be shown behind the Button.
shapeDefines the Button's shape.
colorsColor to be used for background and content of the Button
tonalElevationtonal elevation used to apply a color shift to the button to give the it higher emphasis
borderDefines a border around the Button.
contentPaddingthe spacing values to apply internally between the container and the content
interactionSourcethe MutableInteractionSource representing the stream of Interactions for this button. You can create and pass in your own remembered instance to observe Interactions and customize the appearance / behavior of this button in different states.
contentthe content of the butto