# CardDefaults

Artifact: [androidx.wear.compose:compose-material](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/material/Card.kt+class:androidx.wear.compose.material.CardDefaults) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0)


```
object CardDefaults
```

<br />

*** ** * ** ***

Contains the default values used by `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#Card(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.painter.Painter,androidx.compose.ui.graphics.Color,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.semantics.Role,kotlin.Function1)`

## Summary

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material/CardDefaults#cardBackgroundPainter(androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.LayoutDirection)( startBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, endBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, gradientDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection )` Creates a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` for background colors for a `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#Card(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.painter.Painter,androidx.compose.ui.graphics.Color,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.semantics.Role,kotlin.Function1)`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material/CardDefaults#imageWithScrimBackgroundPainter(androidx.compose.ui.graphics.painter.Painter,androidx.compose.ui.graphics.Brush)( backgroundImagePainter: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter, backgroundImageScrimBrush: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush )` Creates a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` for the background of a `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#Card(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.painter.Painter,androidx.compose.ui.graphics.Color,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.semantics.Role,kotlin.Function1)` that displays an Image with a scrim over the image to make sure that any content above the background will be legible. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/CardDefaults#AppImageSize()` The default size of the app icon/image when used inside a `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#AppCard(kotlin.Function0,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.compose.ui.Modifier,kotlin.Boolean,kotlin.Function1,androidx.compose.ui.graphics.painter.Painter,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,kotlin.Function1)`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/PaddingValues` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/CardDefaults#ContentPadding()` The default content padding used by `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#Card(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.painter.Painter,androidx.compose.ui.graphics.Color,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.semantics.Role,kotlin.Function1)` |

## Public functions

### cardBackgroundPainter

Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.6.0)

```
@Composable
fun cardBackgroundPainter(
    startBackgroundColor: Color = MaterialTheme.colors.primary
                .copy(alpha = 0.30f)
                .compositeOver(MaterialTheme.colors.background),
    endBackgroundColor: Color = MaterialTheme.colors.onSurfaceVariant
                .copy(alpha = 0.20f)
                .compositeOver(MaterialTheme.colors.background),
    gradientDirection: LayoutDirection = LocalLayoutDirection.current
): Painter
```

Creates a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` for background colors for a `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#Card(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.painter.Painter,androidx.compose.ui.graphics.Color,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.semantics.Role,kotlin.Function1)`. Cards typically have a linear gradient for a background. The gradient will be between startBackgroundColor and endBackgroundColor and at an angle of 45 degrees.

Cards should have a content color that contrasts with the background gradient.

| Parameters |
|---|---|
| `startBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = MaterialTheme.colors.primary .copy(alpha = 0.30f) .compositeOver(MaterialTheme.colors.background)` | The background color used at the start of the gradient of this `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#Card(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.painter.Painter,androidx.compose.ui.graphics.Color,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.semantics.Role,kotlin.Function1)` |
| `endBackgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = MaterialTheme.colors.onSurfaceVariant .copy(alpha = 0.20f) .compositeOver(MaterialTheme.colors.background)` | The background color used at the end of the gradient of this `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#Card(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.painter.Painter,androidx.compose.ui.graphics.Color,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.semantics.Role,kotlin.Function1)` |
| `gradientDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection = LocalLayoutDirection.current` | Whether the cards gradient should be start to end (indicated by `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection#Ltr`) or end to start (indicated by `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection#Rtl`). |

### imageWithScrimBackgroundPainter

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0)

```
@Composable
fun imageWithScrimBackgroundPainter(
    backgroundImagePainter: Painter,
    backgroundImageScrimBrush: Brush = Brush.linearGradient(
                colors =
                    listOf(
                        MaterialTheme.colors.surface.copy(alpha = 1.0f),
                        MaterialTheme.colors.surface.copy(alpha = 0f),
                    )
            )
): Painter
```

Creates a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` for the background of a `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#Card(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.painter.Painter,androidx.compose.ui.graphics.Color,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.semantics.Role,kotlin.Function1)` 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: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` | The `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` to use to draw the background of the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#Card(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.painter.Painter,androidx.compose.ui.graphics.Color,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.semantics.Role,kotlin.Function1)` |
| `backgroundImageScrimBrush: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush = Brush.linearGradient( colors = listOf( MaterialTheme.colors.surface.copy(alpha = 1.0f), MaterialTheme.colors.surface.copy(alpha = 0f), ) )` | The `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` to use to paint a scrim over the background image to ensure that any text drawn over the image is legible |

## Public properties

### AppImageSize

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0)

```
val AppImageSize: Dp
```

The default size of the app icon/image when used inside a `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#AppCard(kotlin.Function0,kotlin.Function1,kotlin.Function1,kotlin.Function1,androidx.compose.ui.Modifier,kotlin.Boolean,kotlin.Function1,androidx.compose.ui.graphics.painter.Painter,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,kotlin.Function1)`.

### ContentPadding

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0)

```
val ContentPadding: PaddingValues
```

The default content padding used by `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/package-summary#Card(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.painter.Painter,androidx.compose.ui.graphics.Color,kotlin.Boolean,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.graphics.Shape,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.semantics.Role,kotlin.Function1)`