---
title: "TitleCard"
description: "Opinionated Wear Material 3 `Card` that offers a specific layout to show interactive information
about an application, e.g. a message. TitleCards are designed for use within an application."
type: "component"
---

<div class='type'>Composable Component</div>



Opinionated Wear Material 3 `Card` that offers a specific layout to show interactive information
about an application, e.g. a message. TitleCards are designed for use within an application.

<a id='references'></a>

<div class='sourceset sourceset-android'>Android</div>


```kotlin
@Composable
public fun TitleCard(
    title: @Composable RowScope.() -> Unit,
    modifier: Modifier = Modifier,
    time: @Composable (() -> Unit)? = null,
    subtitle: @Composable (ColumnScope.() -> Unit)? = null,
    shape: Shape = CardDefaults.shape,
    colors: CardColors = CardDefaults.cardColors(),
    border: BorderStroke? = null,
    contentPadding: PaddingValues = CardDefaults.ContentPadding,
    transformation: SurfaceTransformation? = null,
    content: @Composable (() -> Unit)? = null,
): Unit
```


#### Parameters

| | |
| --- | --- |
| title | A slot for displaying the title of the card, expected to be one or two lines of text. |
| modifier | Modifier to be applied to the card |
| time | An optional slot for displaying the time relevant to the contents of the card, expected to be a short piece of text. Depending on whether we have a `content` or not, can be placed at the end of the `title` line or above it. |
| subtitle | An optional slot for displaying the subtitle of the card, expected to be one line of text. |
| shape | Defines the card's shape. It is strongly recommended to use the default as this shape is a key characteristic of the Wear Material Theme |
| colors | `CardColors` that will be used to resolve the colors used for this card. See `CardDefaults.cardColors`. |
| border | A BorderStroke object which is used for drawing outlines. |
| contentPadding | The spacing values to apply internally between the container and the content |
| transformation | Transformation to be used when card appears inside a container that needs to dynamically change its content separately from the background. |
| content | The optional body content of the card. If not provided then title and subtitle are expected to be provided |




<div class='sourceset sourceset-android'>Android</div>


```kotlin
@Composable
public fun TitleCard(
    containerPainter: Painter,
    title: @Composable RowScope.() -> Unit,
    modifier: Modifier = Modifier,
    time: @Composable (() -> Unit)? = null,
    subtitle: @Composable (ColumnScope.() -> Unit)? = null,
    shape: Shape = CardDefaults.shape,
    colors: CardColors = CardDefaults.cardWithContainerPainterColors(),
    border: BorderStroke? = null,
    contentPadding: PaddingValues = CardDefaults.CardWithContainerPainterContentPadding,
    transformation: SurfaceTransformation? = null,
    content: @Composable (() -> Unit)? = null,
): Unit
```


#### Parameters

| | |
| --- | --- |
| containerPainter | The `Painter` to use to draw the container image of the `TitleCard`, such as returned by `CardDefaults.containerPainter`. |
| title | A slot for displaying the title of the card, expected to be one or two lines of text. |
| modifier | Modifier to be applied to the card |
| time | An optional slot for displaying the time relevant to the contents of the card, expected to be a short piece of text. Depending on whether we have a `content` or not, can be placed at the end of the `title` line or above it. |
| subtitle | An optional slot for displaying the subtitle of the card, expected to be one line of text. |
| shape | Defines the card's shape. It is strongly recommended to use the default as this shape is a key characteristic of the Wear Material Theme |
| colors | `CardColors` that will be used to resolve the colors used for this card (the containerColor is overridden by containerPainter). See `CardDefaults.cardWithContainerPainterColors`. |
| border | A BorderStroke object which is used for drawing outlines. |
| contentPadding | The spacing values to apply internally between the container and the content |
| transformation | Transformation to be used when card appears inside a container that needs to dynamically change its content separately from the background. |
| content | The optional body content of the card. If not provided then title and subtitle are expected to be provided |




<div class='sourceset sourceset-android'>Android</div>


```kotlin
@Composable
public fun TitleCard(
    onClick: () -> Unit,
    title: @Composable RowScope.() -> Unit,
    modifier: Modifier = Modifier,
    onLongClick: (() -> Unit)? = null,
    onLongClickLabel: String? = null,
    time: @Composable (() -> Unit)? = null,
    subtitle: @Composable (ColumnScope.() -> Unit)? = null,
    enabled: Boolean = true,
    shape: Shape = CardDefaults.shape,
    colors: CardColors = CardDefaults.cardColors(),
    border: BorderStroke? = null,
    contentPadding: PaddingValues = CardDefaults.ContentPadding,
    interactionSource: MutableInteractionSource? = null,
    transformation: SurfaceTransformation? = null,
    content: @Composable (() -> Unit)? = null,
): Unit
```


#### Parameters

| | |
| --- | --- |
| onClick | Will be called when the user clicks the card |
| title | A slot for displaying the title of the card, expected to be one or two lines of text. |
| modifier | Modifier to be applied to the card |
| onLongClick | Called when this card is long clicked (long-pressed). When this callback is set, `onLongClickLabel` should be set as well. |
| onLongClickLabel | Semantic / accessibility label for the `onLongClick` action. |
| time | An optional slot for displaying the time relevant to the contents of the card, expected to be a short piece of text. Depending on whether we have a `content` or not, can be placed at the end of the `title` line or above it. |
| subtitle | An optional slot for displaying the subtitle of the card, expected to be one line of text. |
| enabled | Controls the enabled state of the card. When false, this card will not be clickable and there will be no ripple effect on click. Wear cards do not have any specific elevation or alpha differences when not enabled - they are simply not clickable. |
| shape | Defines the card's shape. It is strongly recommended to use the default as this shape is a key characteristic of the Wear Material Theme |
| colors | `CardColors` that will be used to resolve the colors used for this card in different states. See `CardDefaults.cardColors`. |
| border | A BorderStroke object which is used for drawing outlines. |
| contentPadding | The spacing values to apply internally between the container and the content |
| interactionSource | an optional hoisted `MutableInteractionSource` for observing and emitting `Interaction`s for this card. You can use this to change the card's appearance or preview the card in different states. Note that if `null` is provided, interactions will still happen internally. |
| transformation | Transformation to be used when card appears inside a container that needs to dynamically change its content separately from the background. |
| content | The optional body content of the card. If not provided then title and subtitle are expected to be provided |




<div class='sourceset sourceset-android'>Android</div>


```kotlin
@Composable
public fun TitleCard(
    onClick: () -> Unit,
    containerPainter: Painter,
    title: @Composable RowScope.() -> Unit,
    modifier: Modifier = Modifier,
    onLongClick: (() -> Unit)? = null,
    onLongClickLabel: String? = null,
    time: @Composable (() -> Unit)? = null,
    subtitle: @Composable (ColumnScope.() -> Unit)? = null,
    enabled: Boolean = true,
    shape: Shape = CardDefaults.shape,
    colors: CardColors = CardDefaults.cardWithContainerPainterColors(),
    border: BorderStroke? = null,
    contentPadding: PaddingValues = CardDefaults.CardWithContainerPainterContentPadding,
    interactionSource: MutableInteractionSource? = null,
    transformation: SurfaceTransformation? = null,
    content: @Composable (() -> Unit)? = null,
): Unit
```


#### Parameters

| | |
| --- | --- |
| onClick | Will be called when the user clicks the card |
| containerPainter | The `Painter` to use to draw the container image of the `TitleCard`, such as returned by `CardDefaults.containerPainter`. |
| title | A slot for displaying the title of the card, expected to be one or two lines of text. |
| modifier | Modifier to be applied to the card |
| onLongClick | Called when this card is long clicked (long-pressed). When this callback is set, `onLongClickLabel` should be set as well. |
| onLongClickLabel | Semantic / accessibility label for the `onLongClick` action. |
| time | An optional slot for displaying the time relevant to the contents of the card, expected to be a short piece of text. Depending on whether we have a `content` or not, can be placed at the end of the `title` line or above it. |
| subtitle | An optional slot for displaying the subtitle of the card, expected to be one line of text. |
| enabled | Controls the enabled state of the card. When false, this card will not be clickable and there will be no ripple effect on click. Wear cards do not have any specific elevation or alpha differences when not enabled - they are simply not clickable. |
| shape | Defines the card's shape. It is strongly recommended to use the default as this shape is a key characteristic of the Wear Material Theme |
| colors | `CardColors` that will be used to resolve the colors used for this card in different states (the containerColor is overridden by containerPainter). See `CardDefaults.cardWithContainerPainterColors`. |
| border | A BorderStroke object which is used for drawing outlines. |
| contentPadding | The spacing values to apply internally between the container and the content |
| interactionSource | an optional hoisted `MutableInteractionSource` for observing and emitting `Interaction`s for this card. You can use this to change the card's appearance or preview the card in different states. Note that if `null` is provided, interactions will still happen internally. |
| transformation | Transformation to be used when card appears inside a container that needs to dynamically change its content separately from the background. |
| content | The optional body content of the card. If not provided then title and subtitle are expected to be provided |






## Code Examples
### NonClickableTitleCardSample
```kotlin
@Composable
fun NonClickableTitleCardSample() {
    TitleCard(title = { Text("Title card") }, time = { Text("Now") }) {
        Text("Non clickable Card content")
    }
}
```
### NonClickableTitleCardWithImageWithTimeAndTitleSample
```kotlin
@Composable
fun NonClickableTitleCardWithImageWithTimeAndTitleSample() {
    TitleCard(
        containerPainter =
            CardDefaults.containerPainter(image = painterResource(id = R.drawable.backgroundimage)),
        title = { Text("Card title") },
        subtitle = { Text("Subtitle") },
        time = { Text("Now") },
        contentPadding = CardDefaults.CardWithContainerPainterContentPadding,
        modifier = Modifier.semantics { contentDescription = "Background image" },
    ) {
        Text("Card content")
    }
}
```
### OutlinedTitleCardSample
```kotlin
@Composable
fun OutlinedTitleCardSample() {
    TitleCard(
        onClick = { /* Do something */ },
        title = { Text("Title card") },
        time = { Text("Now") },
        colors = CardDefaults.outlinedCardColors(),
        border = CardDefaults.outlinedCardBorder(),
    ) {
        Text("Card content")
    }
}
```
### TitleCardSample
```kotlin
@Composable
fun TitleCardSample() {
    TitleCard(
        onClick = { /* Do something */ },
        title = { Text("Title card") },
        time = { Text("Now") },
    ) {
        Text("Card content")
    }
}
```
### TitleCardWithImageWithTimeAndTitleSample
```kotlin
@Composable
fun TitleCardWithImageWithTimeAndTitleSample() {
    TitleCard(
        onClick = { /* Do something */ },
        containerPainter =
            CardDefaults.containerPainter(image = painterResource(id = R.drawable.backgroundimage)),
        title = { Text("Card title") },
        subtitle = { Text("Subtitle") },
        time = { Text("Now") },
        contentPadding = CardDefaults.CardWithContainerPainterContentPadding,
        modifier = Modifier.semantics { contentDescription = "Background image" },
    ) {
        Text("Card content")
    }
}
```
### TitleCardWithMultipleImagesSample
```kotlin
@Preview
@Composable
fun TitleCardWithMultipleImagesSample() {
    TitleCard(
        onClick = { /* Do something */ },
        title = { Text("Title card") },
        time = { Text("Now") },
        modifier = Modifier.semantics { contentDescription = "Background image" },
    ) {
        Spacer(Modifier.height(4.dp))
        Row(modifier = Modifier.fillMaxWidth()) {
            Image(
                modifier =
                    Modifier.weight(2f)
                        .height(68.dp)
                        .align(Alignment.CenterVertically)
                        .clip(RoundedCornerShape(16.dp)),
                painter = painterResource(id = R.drawable.card_content_image),
                contentScale = ContentScale.Crop,
                contentDescription = null,
            )
            Spacer(Modifier.width(4.dp))
            Image(
                modifier =
                    Modifier.weight(1f)
                        .height(68.dp)
                        .align(Alignment.CenterVertically)
                        .clip(RoundedCornerShape(16.dp)),
                painter = painterResource(id = R.drawable.card_content_image),
                contentScale = ContentScale.Crop,
                contentDescription = null,
            )
        }
    }
}
```
### TitleCardWithSubtitleAndTimeSample
```kotlin
@Composable
fun TitleCardWithSubtitleAndTimeSample() {
    TitleCard(
        onClick = { /* Do something */ },
        time = { Text("Now") },
        title = { Text("Title card") },
        subtitle = { Text("Subtitle") },
    )
}
```

