Compose Component

Card

Card is a component used to group related information into a single digestible unit.

Card

Source set: Android
@Composable
public fun Card(
    modifier: Modifier = Modifier,
    title: @Composable (() -> Unit)? = null,
    subtitle: @Composable (() -> Unit)? = null,
    leadingIcon: @Composable (() -> Unit)? = null,
    trailingIcon: @Composable (() -> Unit)? = null,
    shape: Shape = CardDefaults.shape,
    color: Color = CardDefaults.color,
    contentColor: Color = CardDefaults.contentColor(color),
    contentPadding: PaddingValues = CardDefaults.contentPadding,
    interactionSource: MutableInteractionSource? = null,
    content: @Composable () -> Unit,
)

Parameters

modifier the Modifier to be applied to this card
title optional title to be placed above subtitle and content
subtitle optional subtitle to be placed above content, below title
leadingIcon optional leading icon to be placed before content. This is typically an Icon tinted with contentColor by default.
trailingIcon optional trailing icon to be placed after content. This is typically an Icon tinted with contentColor by default.
shape the Shape used to clip this card, and also used to draw the background and border
color background color of this card
contentColor content color used by components inside content, title, subtitle, leadingIcon, and trailingIcon.
contentPadding the spacing values to apply internally between the container and the content. Note that there is additional padding applied around the content / text / icons inside a card, this only affects the outermost content padding.
interactionSource an 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.
content the main content / body text to display inside this card. This is recommended to be limited to 10 lines of text.

Card

Source set: Android
@Composable
public fun Card(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    title: @Composable (() -> Unit)? = null,
    subtitle: @Composable (() -> Unit)? = null,
    leadingIcon: @Composable (() -> Unit)? = null,
    trailingIcon: @Composable (() -> Unit)? = null,
    shape: Shape = CardDefaults.shape,
    color: Color = CardDefaults.color,
    contentColor: Color = CardDefaults.contentColor(color),
    contentPadding: PaddingValues = CardDefaults.contentPadding,
    interactionSource: MutableInteractionSource? = null,
    content: @Composable () -> Unit,
)

Parameters

onClick called when this card item is clicked
modifier the Modifier to be applied to this card
title optional title to be placed above subtitle and content
subtitle optional subtitle to be placed above content, below title
leadingIcon optional leading icon to be placed before content. This is typically an Icon tinted with contentColor by default.
trailingIcon optional trailing icon to be placed after content. This is typically an Icon tinted with contentColor by default.
shape the Shape used to clip this card, and also used to draw the background and border
color background color of this card
contentColor content color used by components inside content, title, subtitle, leadingIcon, and trailingIcon.
contentPadding the spacing values to apply internally between the container and the content. Note that there is additional padding applied around the content / text / icons inside a card, this only affects the outermost content padding.
interactionSource an 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.
content the main content / body text to display inside this card. This is recommended to be limited to 10 lines of text.

Content updated: