{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

CardDefaults

public static class CardDefaults


Contains the default values used by all card types.

Summary

Public fields

static @NonNull CardDefaults

Public methods

final @NonNull CardColors

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

final @NonNull CardColors
@Composable
cardColors(
    @NonNull Color containerColor,
    @NonNull Color contentColor,
    @NonNull Color disabledContainerColor,
    @NonNull Color disabledContentColor
)

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

final @NonNull CardElevation
@Composable
cardElevation(
    @NonNull Dp defaultElevation,
    @NonNull Dp pressedElevation,
    @NonNull Dp focusedElevation,
    @NonNull Dp hoveredElevation,
    @NonNull Dp draggedElevation,
    @NonNull Dp disabledElevation
)

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

final @NonNull CardColors

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

final @NonNull CardColors
@Composable
elevatedCardColors(
    @NonNull Color containerColor,
    @NonNull Color contentColor,
    @NonNull Color disabledContainerColor,
    @NonNull Color disabledContentColor
)

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

final @NonNull CardElevation
@Composable
elevatedCardElevation(
    @NonNull Dp defaultElevation,
    @NonNull Dp pressedElevation,
    @NonNull Dp focusedElevation,
    @NonNull Dp hoveredElevation,
    @NonNull Dp draggedElevation,
    @NonNull Dp disabledElevation
)

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

final @NonNull Shape

Default shape for an elevated card.

final @NonNull Shape

Default shape for an outlined card.

final @NonNull Shape

Default shape for a card.

final @NonNull BorderStroke
@Composable
outlinedCardBorder(boolean enabled)

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

final @NonNull CardColors

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

final @NonNull CardColors
@Composable
outlinedCardColors(
    @NonNull Color containerColor,
    @NonNull Color contentColor,
    @NonNull Color disabledContainerColor,
    @NonNull Color disabledContentColor
)

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

final @NonNull CardElevation
@Composable
outlinedCardElevation(
    @NonNull Dp defaultElevation,
    @NonNull Dp pressedElevation,
    @NonNull Dp focusedElevation,
    @NonNull Dp hoveredElevation,
    @NonNull Dp draggedElevation,
    @NonNull Dp disabledElevation
)

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

Public fields

INSTANCE

public static @NonNull CardDefaults INSTANCE

Public methods

cardColors

@Composable
public final @NonNull CardColors cardColors()

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

cardColors

@Composable
public final @NonNull CardColors cardColors(
    @NonNull Color containerColor,
    @NonNull Color contentColor,
    @NonNull Color disabledContainerColor,
    @NonNull Color disabledContentColor
)

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

Parameters
@NonNull Color containerColor

the container color of this Card when enabled.

@NonNull Color contentColor

the content color of this Card when enabled.

@NonNull Color disabledContainerColor

the container color of this Card when not enabled.

@NonNull Color disabledContentColor

the content color of this Card when not enabled.

cardElevation

@Composable
public final @NonNull CardElevation cardElevation(
    @NonNull Dp defaultElevation,
    @NonNull Dp pressedElevation,
    @NonNull Dp focusedElevation,
    @NonNull Dp hoveredElevation,
    @NonNull Dp draggedElevation,
    @NonNull Dp disabledElevation
)

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

Parameters
@NonNull Dp defaultElevation

the elevation used when the Card is has no other Interactions.

@NonNull Dp pressedElevation

the elevation used when the Card is pressed.

@NonNull Dp focusedElevation

the elevation used when the Card is focused.

@NonNull Dp hoveredElevation

the elevation used when the Card is hovered.

@NonNull Dp draggedElevation

the elevation used when the Card is dragged.

elevatedCardColors

@Composable
public final @NonNull CardColors elevatedCardColors()

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

elevatedCardColors

@Composable
public final @NonNull CardColors elevatedCardColors(
    @NonNull Color containerColor,
    @NonNull Color contentColor,
    @NonNull Color disabledContainerColor,
    @NonNull Color disabledContentColor
)

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

Parameters
@NonNull Color containerColor

the container color of this ElevatedCard when enabled.

@NonNull Color contentColor

the content color of this ElevatedCard when enabled.

@NonNull Color disabledContainerColor

the container color of this ElevatedCard when not enabled.

@NonNull Color disabledContentColor

the content color of this ElevatedCard when not enabled.

elevatedCardElevation

@Composable
public final @NonNull CardElevation elevatedCardElevation(
    @NonNull Dp defaultElevation,
    @NonNull Dp pressedElevation,
    @NonNull Dp focusedElevation,
    @NonNull Dp hoveredElevation,
    @NonNull Dp draggedElevation,
    @NonNull Dp disabledElevation
)

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

Parameters
@NonNull Dp defaultElevation

the elevation used when the ElevatedCard is has no other Interactions.

@NonNull Dp pressedElevation

the elevation used when the ElevatedCard is pressed.

@NonNull Dp focusedElevation

the elevation used when the ElevatedCard is focused.

@NonNull Dp hoveredElevation

the elevation used when the ElevatedCard is hovered.

@NonNull Dp draggedElevation

the elevation used when the ElevatedCard is dragged.

getElevatedShape

@Composable
public final @NonNull Shape getElevatedShape()

Default shape for an elevated card.

getOutlinedShape

@Composable
public final @NonNull Shape getOutlinedShape()

Default shape for an outlined card.

getShape

@Composable
public final @NonNull Shape getShape()

Default shape for a card.

outlinedCardBorder

@Composable
public final @NonNull BorderStroke outlinedCardBorder(boolean enabled)

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

Parameters
boolean enabled

whether the card is enabled

outlinedCardColors

@Composable
public final @NonNull CardColors outlinedCardColors()

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

outlinedCardColors

@Composable
public final @NonNull CardColors outlinedCardColors(
    @NonNull Color containerColor,
    @NonNull Color contentColor,
    @NonNull Color disabledContainerColor,
    @NonNull Color disabledContentColor
)

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

Parameters
@NonNull Color containerColor

the container color of this OutlinedCard when enabled.

@NonNull Color contentColor

the content color of this OutlinedCard when enabled.

@NonNull Color disabledContainerColor

the container color of this OutlinedCard when not enabled.

@NonNull Color disabledContentColor

the content color of this OutlinedCard when not enabled.

outlinedCardElevation

@Composable
public final @NonNull CardElevation outlinedCardElevation(
    @NonNull Dp defaultElevation,
    @NonNull Dp pressedElevation,
    @NonNull Dp focusedElevation,
    @NonNull Dp hoveredElevation,
    @NonNull Dp draggedElevation,
    @NonNull Dp disabledElevation
)

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

Parameters
@NonNull Dp defaultElevation

the elevation used when the OutlinedCard is has no other Interactions.

@NonNull Dp pressedElevation

the elevation used when the OutlinedCard is pressed.

@NonNull Dp focusedElevation

the elevation used when the OutlinedCard is focused.

@NonNull Dp hoveredElevation

the elevation used when the OutlinedCard is hovered.

@NonNull Dp draggedElevation

the elevation used when the OutlinedCard is dragged.