Object

CardDefaults

Contains the default values used by Card

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Android
public object CardDefaults

Contains the default values used by Card

Functions

@Composable public fun cardColors(): CardColors

Creates a CardColors that represents the default container and content colors used in a Card, AppCard or TitleCard.

cardColors

@Composable
public fun cardColors(
    containerColor: Color = Color.Unspecified,
    contentColor: Color = Color.Unspecified,
    appNameColor: Color = Color.Unspecified,
    timeColor: Color = Color.Unspecified,
    titleColor: Color = Color.Unspecified,
    subtitleColor: Color = Color.Unspecified,
): CardColors

Creates a CardColors that represents the default container and content colors used in a Card, AppCard or TitleCard.

Parameters

containerColor the container color of this Card.
contentColor the content color of this Card.
appNameColor the color used for appName, only applies to AppCard.
timeColor the color used for time, applies to AppCard and TitleCard.
titleColor the color used for title, applies to AppCard and TitleCard.
subtitleColor the color used for subtitle, applies to TitleCard.

outlinedCardColors

@Composable
public fun outlinedCardColors(): CardColors

Creates a CardColors that represents the default container and content colors used in an OutlinedCard, outlined AppCard or TitleCard.


outlinedCardColors

@Composable
public fun outlinedCardColors(
    contentColor: Color = Color.Unspecified,
    appNameColor: Color = Color.Unspecified,
    timeColor: Color = Color.Unspecified,
    titleColor: Color = Color.Unspecified,
    subtitleColor: Color = Color.Unspecified,
): CardColors

Creates a CardColors that represents the default container and content colors used in an OutlinedCard, outlined AppCard or TitleCard.

Parameters

contentColor the content color of this OutlinedCard.
appNameColor the color used for appName, only applies to AppCard.
timeColor the color used for time, applies to AppCard and TitleCard.
titleColor the color used for title, applies to AppCard and TitleCard.
subtitleColor the color used for subtitle, applies to TitleCard.

cardWithContainerPainterColors

@Composable
public fun cardWithContainerPainterColors(): CardColors

Creates a CardColors that represents the default container and content colors used in a Card with image container painter.


cardWithContainerPainterColors

@Composable
public fun cardWithContainerPainterColors(
    contentColor: Color = Color.Unspecified,
    appNameColor: Color = Color.Unspecified,
    timeColor: Color = Color.Unspecified,
    titleColor: Color = Color.Unspecified,
    subtitleColor: Color = Color.Unspecified,
): CardColors

Creates a CardColors that represents the default container and content colors used in a TitleCard with Image set as a background.

Parameters

contentColor the content color of this Card.
appNameColor the color used for appName, only applies to AppCard.
timeColor the color used for time.
titleColor the color used for title.
subtitleColor the color used for subtitle.

containerPainter

@Composable
public fun containerPainter(
    image: Painter,
    scrim: Brush = scrimBrush(),
    sizeToIntrinsics: Boolean = false,
    alignment: Alignment = Alignment.Center,
    contentScale: ContentScale = ContentScale.Fit,
    alpha: Float = DefaultAlpha,
): Painter

Creates a Painter for the background of an Card that displays an image with a scrim on top to make sure that any content above the background will be legible.

An Image background is a means to reinforce the meaning of information in a Card, e.g. to help to contextualize the information. Cards should have a content color that contrasts with the background image and scrim.

Parameters

image The Painter to use to draw the container background of the Card
scrim The Brush to use to paint a scrim over the container image to ensure that any text drawn over the image is legible
sizeToIntrinsics When false (the default), fills the available space within the container. Pass true to retain the size of the image.
alignment Specifies alignment of the container image painter relative to the container.
contentScale Strategy for scaling the painter if its size does not match the container.
alpha Opacity of the container image painter and scrim.

scrimBrush

@Composable
public fun scrimBrush(): Brush

Creates a Brush for the recommended scrim drawn on top of image container backgrounds.


outlinedCardBorder

@Composable
public fun outlinedCardBorder(
    outlineColor: Color = OutlinedCardTokens.ContainerBorderColor.value,
    borderWidth: Dp = OutlinedCardTokens.BorderWidth,
): BorderStroke

Creates a BorderStroke that represents the default border used in Outlined Cards.

Parameters

outlineColor The color to be used for drawing an outline.
borderWidth width of the border in Dp.