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
@Composable
imageCardColors(
    containerPainter: Painter,
    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
imageWithScrimBackgroundPainter(
    backgroundImagePainter: Painter,
    backgroundImageScrimBrush: Brush,
    forcedSize: Size?
)

Creates a Painter for the background of a Card that displays an Image with a scrim over the image 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.

Public properties

Dp

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

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

PaddingValues

ContentPadding for use with an image background in order to show more of the image.

Shape

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

Public functions

cardColors

Added in 1.0.0-alpha30
@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.

imageCardColors

@Composable
fun imageCardColors(
    containerPainter: Painter,
    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
containerPainter: Painter

a Painter which is used for background drawing.

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.

imageWithScrimBackgroundPainter

Added in 1.0.0-alpha30
@Composable
fun imageWithScrimBackgroundPainter(
    backgroundImagePainter: Painter,
    backgroundImageScrimBrush: Brush = SolidColor(overlayScrimColor),
    forcedSize: Size? = Size.Unspecified
): Painter

Creates a Painter for the background of a Card that displays an Image with a scrim over the image 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 in a TitleCard

Cards should have a content color that contrasts with the background image and scrim

Parameters
backgroundImagePainter: Painter

The Painter to use to draw the background of the Card

backgroundImageScrimBrush: Brush = SolidColor(overlayScrimColor)

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

forcedSize: Size? = Size.Unspecified

The value for Painter.intrinsicSize, a value of null will respect the backgroundImagePainter size. Defaults to Size.Unspecified which does not affect component size.

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-alpha30
@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.

Public properties

AppImageSize

Added in 1.0.0-alpha30
val AppImageSizeDp

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

ContentPadding

Added in 1.0.0-alpha30
val ContentPaddingPaddingValues

The default content padding used by Card

Height

Added in 1.0.0-alpha30
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-alpha30
val ImageBottomPaddingDp

Additional bottom padding added for TitleCard with an image background

ImageContentPadding

Added in 1.0.0-alpha30
val ImageContentPaddingPaddingValues

ContentPadding for use with an image background in order to show more of the image. Expected to be used with TitleCard's with an image background

shape

Added in 1.0.0-alpha30
val shapeShape

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