Object

CardDefaults

Contains the default values used by all card types.

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Common
object CardDefaults

Contains the default values used by all card types.

Properties

Common
val shape: Shape

Default shape for a card.

Common
val elevatedShape: Shape

Default shape for an elevated card.

Common
val outlinedShape: Shape

Default shape for an outlined card.

Functions

cardElevation

@Composable
    fun cardElevation(
        defaultElevation: Dp = FilledCardTokens.ContainerElevation,
        pressedElevation: Dp = FilledCardTokens.PressedContainerElevation,
        focusedElevation: Dp = FilledCardTokens.FocusContainerElevation,
        hoveredElevation: Dp = FilledCardTokens.HoverContainerElevation,
        draggedElevation: Dp = FilledCardTokens.DraggedContainerElevation,
        disabledElevation: Dp = FilledCardTokens.DisabledContainerElevation,
    ): CardElevation

Creates a CardElevation that will animate between the provided values according to the Material specification for a Card.

Parameters

defaultElevation the elevation used when the Card is has no other Interactions.
pressedElevation the elevation used when the Card is pressed.
focusedElevation the elevation used when the Card is focused.
hoveredElevation the elevation used when the Card is hovered.
draggedElevation the elevation used when the Card is dragged.
disabledElevation the elevation used when the Card is disabled.

elevatedCardElevation

@Composable
    fun elevatedCardElevation(
        defaultElevation: Dp = ElevatedCardTokens.ContainerElevation,
        pressedElevation: Dp = ElevatedCardTokens.PressedContainerElevation,
        focusedElevation: Dp = ElevatedCardTokens.FocusContainerElevation,
        hoveredElevation: Dp = ElevatedCardTokens.HoverContainerElevation,
        draggedElevation: Dp = ElevatedCardTokens.DraggedContainerElevation,
        disabledElevation: Dp = ElevatedCardTokens.DisabledContainerElevation,
    ): CardElevation

Creates a CardElevation that will animate between the provided values according to the Material specification for an ElevatedCard.

Parameters

defaultElevation the elevation used when the ElevatedCard is has no other Interactions.
pressedElevation the elevation used when the ElevatedCard is pressed.
focusedElevation the elevation used when the ElevatedCard is focused.
hoveredElevation the elevation used when the ElevatedCard is hovered.
draggedElevation the elevation used when the ElevatedCard is dragged.
disabledElevation the elevation used when the Card is disabled.

outlinedCardElevation

@Composable
    fun outlinedCardElevation(
        defaultElevation: Dp = OutlinedCardTokens.ContainerElevation,
        pressedElevation: Dp = defaultElevation,
        focusedElevation: Dp = defaultElevation,
        hoveredElevation: Dp = defaultElevation,
        draggedElevation: Dp = OutlinedCardTokens.DraggedContainerElevation,
        disabledElevation: Dp = OutlinedCardTokens.DisabledContainerElevation,
    ): CardElevation

Creates a CardElevation that will animate between the provided values according to the Material specification for an OutlinedCard.

Parameters

defaultElevation the elevation used when the OutlinedCard is has no other Interactions.
pressedElevation the elevation used when the OutlinedCard is pressed.
focusedElevation the elevation used when the OutlinedCard is focused.
hoveredElevation the elevation used when the OutlinedCard is hovered.
draggedElevation the elevation used when the OutlinedCard is dragged.
@Composable fun cardColors() = MaterialTheme.colorScheme.defaultCardColors

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


cardColors

@Composable
    fun cardColors(
        containerColor: Color = Color.Unspecified,
        contentColor: Color = contentColorFor(containerColor),
        disabledContainerColor: Color = Color.Unspecified,
        disabledContentColor: Color = contentColor.copy(DisabledAlpha),
    ): CardColors

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

Parameters

containerColor the container color of this Card when enabled.
contentColor the content color of this Card when enabled.
disabledContainerColor the container color of this Card when not enabled.
disabledContentColor the content color of this Card when not enabled.
@Composable fun elevatedCardColors() = MaterialTheme.colorScheme.defaultElevatedCardColors

Creates a CardColors that represents the default container and content colors used in an ElevatedCard.


elevatedCardColors

@Composable
    fun elevatedCardColors(
        containerColor: Color = Color.Unspecified,
        contentColor: Color = contentColorFor(containerColor),
        disabledContainerColor: Color = Color.Unspecified,
        disabledContentColor: Color = contentColor.copy(DisabledAlpha),
    ): CardColors

Creates a CardColors that represents the default container and content colors used in an ElevatedCard.

Parameters

containerColor the container color of this ElevatedCard when enabled.
contentColor the content color of this ElevatedCard when enabled.
disabledContainerColor the container color of this ElevatedCard when not enabled.
disabledContentColor the content color of this ElevatedCard when not enabled.
@Composable fun outlinedCardColors() = MaterialTheme.colorScheme.defaultOutlinedCardColors

Creates a CardColors that represents the default container and content colors used in an OutlinedCard.


outlinedCardColors

@Composable
    fun outlinedCardColors(
        containerColor: Color = Color.Unspecified,
        contentColor: Color = contentColorFor(containerColor),
        disabledContainerColor: Color = Color.Unspecified,
        disabledContentColor: Color = contentColorFor(containerColor).copy(DisabledAlpha),
    ): CardColors

Creates a CardColors that represents the default container and content colors used in an OutlinedCard.

Parameters

containerColor the container color of this OutlinedCard when enabled.
contentColor the content color of this OutlinedCard when enabled.
disabledContainerColor the container color of this OutlinedCard when not enabled.
disabledContentColor the content color of this OutlinedCard when not enabled.

outlinedCardBorder

@Composable
    fun outlinedCardBorder(enabled: Boolean = true): BorderStroke

Creates a BorderStroke that represents the default border used in OutlinedCard.

Parameters

enabled whether the card is enabled