CompactCard

fun CompactCard(title: String, compactMediaContainer: CompactMediaContainer, modifier: Modifier = Modifier, label: String? = null, addon: CompactCardAddon = CompactCardAddon.None, variant: CompactCardVariant = CompactCardVariant.Regular, compactCardTheme: CompactCardTheme? = null, showArrow: Boolean = true, titleSize: TitleSize = TitleSize.Medium, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, onClick: () -> Unit)(source)

Compact Card is a component that displays simple content and an entry point to other pages for more detailed information.

Parameters

title

Typically the title of the page you are linking to.

compactMediaContainer

The media container which can contains Image or Video.

modifier

Modifier to be applied to the layout of the card.

label

A small text label typically used to show categorization or attribution.

addon

Addition content to display on the card, such as a badge, or commercial message (can be used only on Image).

variant

The variant of the card, affecting its visual style.

compactCardTheme

The theme of the card, which define its colors and overall appearance.

showArrow

Toggle on/off arrow in the footer.

titleSize

The size of the title which can be TitleSize.Medium, TitleSize.Small, or TitleSize.XSmall.

interactionSource

The source of interactions for the card, such as hover or focus events.

onClick

Lambda to be invoked when the card is clicked.

See also

Samples

val title = "Title"
val label = "Label"
val painter = painterResource(R.drawable.ic_avatar_person)
val context = LocalContext.current

SkapaTheme2(isSystemInDarkTheme()) {
    Column(
        verticalArrangement = Arrangement.spacedBy(SkapaSpacing.space150),
        horizontalAlignment = Alignment.CenterHorizontally,
        modifier = Modifier
            .padding(horizontal = SkapaSpacing.space100)
            .verticalScroll(rememberScrollState())
    ) {
        CompactCard(
            title = title,
            compactMediaContainer = CompactMediaContainer.Image(painter = painter, contentDescription = "Avatar image with dog"),
            label = label
        ) {
            Toast
                .makeText(context, "Avatar CompactCard", Toast.LENGTH_SHORT)
                .show()
        }

        Spacer(modifier = Modifier.height(SkapaSpacing.space150))

        CompactCard(
            title = title,
            compactMediaContainer = CompactMediaContainer.Image(painter = painter, contentDescription = "Avatar image with dog"),
            label = label,
            variant = CompactCardVariant.Simple
        ) {
            Toast
                .makeText(context, "Avatar CompactCard", Toast.LENGTH_SHORT)
                .show()
        }
    }
}