Card
Composable Component
Base level Wear Material Card
that offers a single slot to take any content.
Android
@Composable
public fun Card(
onClick: () -> Unit,
modifier: Modifier = Modifier,
backgroundPainter: Painter = CardDefaults.cardBackgroundPainter(),
contentColor: Color = MaterialTheme.colors.onSurfaceVariant,
enabled: Boolean = true,
contentPadding: PaddingValues = CardDefaults.ContentPadding,
shape: Shape = MaterialTheme.shapes.large,
interactionSource: MutableInteractionSource? = null,
role: Role? = null,
content: @Composable ColumnScope.() -> Unit,
)
Parameters
onClick | Will be called when the user clicks the card |
modifier | Modifier to be applied to the card |
backgroundPainter | A painter used to paint the background of the card. A card will normally have a gradient background. Use CardDefaults.cardBackgroundPainter() to obtain an appropriate painter |
contentColor | The default color to use for content() unless explicitly set. |
enabled | Controls 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. |
contentPadding | The spacing values to apply internally between the container and the content |
shape | Defines the card's shape. It is strongly recommended to use the default as this shape is a key characteristic of the Wear Material Theme |
interactionSource | an optional hoisted MutableInteractionSource for observing and emitting Interaction s 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. |
role | The type of user interface element. Accessibility services might use this to describe the element or do customizations |
content | Slot for composable body content displayed on the Card |