Card

Composable Component

Base level Wear Material 3 Card that offers a single slot to take any content.

Android
@Composable
public fun Card(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    onLongClick: (() -> Unit)? = null,
    onLongClickLabel: String? = null,
    enabled: Boolean = true,
    shape: Shape = CardDefaults.shape,
    colors: CardColors = CardDefaults.cardColors(),
    border: BorderStroke? = null,
    contentPadding: PaddingValues = CardDefaults.ContentPadding,
    interactionSource: MutableInteractionSource? = null,
    transformation: SurfaceTransformation? = null,
    content: @Composable ColumnScope.() -> Unit,
)

Parameters

onClickWill be called when the user clicks the card
modifierModifier to be applied to the card
onLongClickCalled when this card is long clicked (long-pressed). When this callback is set, onLongClickLabel should be set as well.
onLongClickLabelSemantic / accessibility label for the onLongClick action.
enabledControls the enabled state of the card. When false, this card will not be clickable and there will be no ripple effect on click. Wear cards do not have any specific elevation or alpha differences when not enabled - they are simply not clickable.
shapeDefines the card's shape. It is strongly recommended to use the default as this shape is a key characteristic of the Wear Material Theme
colorsCardColors that will be used to resolve the colors used for this card in different states. See CardDefaults.cardColors.
borderA BorderStroke object which is used for drawing outlines.
contentPaddingThe spacing values to apply internally between the container and the content
interactionSourcean optional hoisted MutableInteractionSource for observing and emitting Interactions for this card. You can use this to change the card's appearance or preview the card in different states. Note that if null is provided, interactions will still happen internally.
transformationTransformation to be used when card appears inside a container that needs to dynamically change its content separately from the background.
contentThe main slot for a content of this card
Android
@Composable
public fun Card(
    onClick: () -> Unit,
    containerPainter: Painter,
    modifier: Modifier = Modifier,
    onLongClick: (() -> Unit)? = null,
    onLongClickLabel: String? = null,
    enabled: Boolean = true,
    shape: Shape = CardDefaults.shape,
    colors: CardColors = CardDefaults.cardWithContainerPainterColors(),
    border: BorderStroke? = null,
    contentPadding: PaddingValues = CardDefaults.CardWithContainerPainterContentPadding,
    interactionSource: MutableInteractionSource? = null,
    transformation: SurfaceTransformation? = null,
    content: @Composable ColumnScope.() -> Unit,
): Unit

Parameters

onClickWill be called when the user clicks the card
containerPainterThe Painter to use to draw the container image of the Card, such as returned by CardDefaults.containerPainter.
modifierModifier to be applied to the card
onLongClickCalled when this card is long clicked (long-pressed). When this callback is set, onLongClickLabel should be set as well.
onLongClickLabelSemantic / accessibility label for the onLongClick action.
enabledControls the enabled state of the card. When false, this card will not be clickable and there will be no ripple effect on click. Wear cards do not have any specific elevation or alpha differences when not enabled - they are simply not clickable.
shapeDefines the card's shape. It is strongly recommended to use the default as this shape is a key characteristic of the Wear Material Theme
colorsCardColors that will be used to resolve the colors used for this card in different states (the containerColor is overridden by containerPainter). See CardDefaults.cardWithContainerPainterColors.
borderA BorderStroke object which is used for drawing outlines.
contentPaddingThe spacing values to apply internally between the container and the content
interactionSourcean optional hoisted MutableInteractionSource for observing and emitting Interactions for this card. You can use this to change the card's appearance or preview the card in different states. Note that if null is provided, interactions will still happen internally.
transformationTransformation to be used when card appears inside a container that needs to dynamically change its content separately from the background.
contentThe main slot for a content of this card