object CardDefaults


Contains the default values used by Card

Summary

Public functions

CardColors

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

CardColors
@Composable
cardColors(
    containerColor: Color,
    contentColor: Color,
    appNameColor: Color,
    timeColor: Color,
    titleColor: Color,
    subtitleColor: Color
)

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

CardColors

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

CardColors
@Composable
cardWithContainerPainterColors(
    contentColor: Color,
    appNameColor: Color,
    timeColor: Color,
    titleColor: Color,
    subtitleColor: Color
)

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

Painter
@Composable
containerPainter(
    image: Painter,
    scrim: Brush,
    sizeToIntrinsics: Boolean,
    alignment: Alignment,
    contentScale: ContentScale,
    alpha: Float
)

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

BorderStroke
@Composable
outlinedCardBorder(outlineColor: Color, borderWidth: Dp)

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

CardColors

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

CardColors
@Composable
outlinedCardColors(
    contentColor: Color,
    appNameColor: Color,
    timeColor: Color,
    titleColor: Color,
    subtitleColor: Color
)

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

Brush

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

Public properties

Dp

The default size of the app icon/image when used inside a AppCard.

PaddingValues

ContentPadding for use cards that have an image background in order to show more of the image

PaddingValues

The default content padding used by Card

Dp

The default height of Card, AppCard and TitleCard.

Dp

Additional bottom padding added for TitleCard with an image background

Color

Returns a scrim color that can be used to draw a scrim on top of an image to ensure that any text drawn over the image is legible.

Shape

The default shape of Card, which determines its corner radius.

Public functions

cardColors

Added in 1.0.0-alpha37
@Composable
fun cardColors(): CardColors

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

cardColors

@Composable
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: Color = Color.Unspecified

the container color of this Card.

contentColor: Color = Color.Unspecified

the content color of this Card.

appNameColor: Color = Color.Unspecified

the color used for appName, only applies to AppCard.

timeColor: Color = Color.Unspecified

the color used for time, applies to AppCard and TitleCard.

titleColor: Color = Color.Unspecified

the color used for title, applies to AppCard and TitleCard.

subtitleColor: Color = Color.Unspecified

the color used for subtitle, applies to TitleCard.

cardWithContainerPainterColors

Added in 1.0.0-alpha37
@Composable
fun cardWithContainerPainterColors(): CardColors

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

cardWithContainerPainterColors

@Composable
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: Color = Color.Unspecified

the content color of this Card.

appNameColor: Color = Color.Unspecified

the color used for appName, only applies to AppCard.

timeColor: Color = Color.Unspecified

the color used for time.

titleColor: Color = Color.Unspecified

the color used for title.

subtitleColor: Color = Color.Unspecified

the color used for subtitle.

containerPainter

Added in 1.0.0-alpha37
@Composable
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 ImageCard 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: Painter

The Painter to use to draw the container background of the Card

scrim: Brush = scrimBrush()

The Brush to use to paint a scrim over the container image to ensure that any text drawn over the image is legible

sizeToIntrinsics: Boolean = false

When false (the default), fills the available space within the container. Pass true to retain the size of the image.

alignment: Alignment = Alignment.Center

Specifies alignment of the container image painter relative to the container.

contentScale: ContentScale = ContentScale.Fit

Strategy for scaling the painter if its size does not match the container.

alpha: Float = DefaultAlpha

Opacity of the container image painter and scrim.

outlinedCardBorder

@Composable
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: Color = OutlinedCardTokens.ContainerBorderColor.value

The color to be used for drawing an outline.

borderWidth: Dp = OutlinedCardTokens.BorderWidth

width of the border in Dp.

outlinedCardColors

Added in 1.0.0-alpha37
@Composable
fun outlinedCardColors(): CardColors

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

outlinedCardColors

@Composable
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: Color = Color.Unspecified

the content color of this OutlinedCard.

appNameColor: Color = Color.Unspecified

the color used for appName, only applies to AppCard.

timeColor: Color = Color.Unspecified

the color used for time, applies to AppCard and TitleCard.

titleColor: Color = Color.Unspecified

the color used for title, applies to AppCard and TitleCard.

subtitleColor: Color = Color.Unspecified

the color used for subtitle, applies to TitleCard.

scrimBrush

Added in 1.0.0-alpha37
@Composable
fun scrimBrush(): Brush

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

Public properties

AppImageSize

Added in 1.0.0-alpha37
val AppImageSizeDp

The default size of the app icon/image when used inside a AppCard.

CardWithContainerPainterContentPadding

Added in 1.0.0-alpha37
val CardWithContainerPainterContentPaddingPaddingValues

ContentPadding for use cards that have an image background in order to show more of the image

ContentPadding

Added in 1.0.0-alpha37
val ContentPaddingPaddingValues

The default content padding used by Card

Height

Added in 1.0.0-alpha37
val HeightDp

The default height of Card, AppCard and TitleCard. The card will increase its height to accommodate the contents, if necessary.

ImageBottomPadding

Added in 1.0.0-alpha37
val ImageBottomPaddingDp

Additional bottom padding added for TitleCard with an image background

scrimColor

Added in 1.0.0-alpha37
val scrimColorColor

Returns a scrim color that can be used to draw a scrim on top of an image to ensure that any text drawn over the image is legible.

shape

Added in 1.0.0-alpha37
val shapeShape

The default shape of Card, which determines its corner radius.