UX4G Logo
Components

Card

Versatile surface container supporting Vertical & Horizontal layouts, media banners with tags, headers with avatars, status chips, body text, bottom chips, and action button footers

The UX4G Card suite provides rich, modular surface containers designed for citizen self-service dashboards, scheme benefits, service discovery, and application tracking:

  1. Standard / Basic Card: Clean surface container with title, subtitle, description, and optional click interaction.
  2. Card with Action Buttons: Interactive card featuring customizable primary and secondary footer action buttons.
  3. Horizontal Card: Split-layout card with media thumbnail on the left and structured content on the right.
  4. Complex Vertical Card: Feature-complete card with full-bleed media banner, label badge, top-end bookmark, avatar header, status row, body text, bottom tag chips, and dual action buttons.
  5. Complex Horizontal Card: Rich horizontal layout with media banner, avatar, status chips, description, and primary CTA.

Import from com.ux4g.designsystemv1.components.Ux4gCard.


Interactive Previews

1. Standard / Basic Card

Ux4gCard - Standard / BasicJetpack Compose
UX4G Standard Card Preview

Ux4gCard - With Action ButtonsJetpack Compose
UX4G Card with Action Buttons Preview

3. Horizontal Card (Ux4gCardDirection.Horizontal)

Ux4gCard - Horizontal OrientationJetpack Compose
UX4G Horizontal Card Preview

4. Complex Vertical Card (Media, Avatar, Chips & Actions)

Ux4gCard - Complex Vertical BannerJetpack Compose
UX4G Complex Vertical Card Preview

5. Complex Horizontal Card (Media, Avatar & Status Chips)

Ux4gCard - Complex Horizontal LayoutJetpack Compose
UX4G Complex Horizontal Card Preview

Kotlin Usage

Card Showcase Example
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.BookmarkBorder
import androidx.compose.material.icons.filled.Category
import androidx.compose.material.icons.filled.Share
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.ux4g.designsystemv1.components.Ux4gCard
import com.ux4g.designsystemv1.components.Ux4gCardDirection
import com.ux4g.designsystemv1.components.Ux4gCardFooterAlignment
import com.ux4g.designsystemv1.components.Ux4gCardFooterType
import com.ux4g.designsystemv1.components.avatar_component.Ux4gAvatar
import com.ux4g.designsystemv1.components.avatar_component.Ux4gAvatarSize
import com.ux4g.designsystemv1.foundation.Ux4gColors

@Composable
fun CardShowcaseScreen() {
    Column(
        modifier = Modifier.padding(16.dp),
        verticalArrangement = Arrangement.spacedBy(16.dp)
    ) {
        // 1. Basic Informational Card
        Ux4gCard(
            title = "Digital India Initiative",
            subtitle = "Ministry of Electronics & IT",
            body = "Empowering citizens with access to digital infrastructure and government e-services."
        )

        // 2. Card with Primary and Secondary Buttons
        Ux4gCard(
            title = "Aadhaar e-KYC Verification",
            subtitle = "Action Required",
            body = "Complete one-time OTP authentication to unlock all digital services.",
            footerType = Ux4gCardFooterType.PrimaryAndSecondary,
            primaryButtonText = "Verify Now",
            secondaryButtonText = "Remind Later",
            onPrimaryClick = { /* Start OTP flow */ },
            onSecondaryClick = { /* Dismiss */ }
        )

        // 3. Rich Vertical Card with Media Banner & Avatar
        Ux4gCard(
            direction = Ux4gCardDirection.Vertical,
            mediaImageUrl = "https://picsum.photos/seed/agri/600/300",
            mediaHeight = 180.dp,
            mediaLabelText = "New Scheme",
            avatar = {
                Ux4gAvatar(
                    size = Ux4gAvatarSize.M,
                    initials = "PM"
                )
            },
            title = "PM Kisan Samman Nidhi",
            subtitle = "Direct Benefit Transfer",
            statusChips = listOf("Active", "Central Sector"),
            body = "Direct financial support of ₹6,000 per year in three equal installments to eligible farmers.",
            bottomChips = listOf("DBT", "Agriculture", "Farmers"),
            footerType = Ux4gCardFooterType.PrimaryAndSecondary,
            primaryButtonText = "Apply Now",
            secondaryButtonText = "Guidelines"
        )
    }
}

Parameters

Ux4gCard Props

PropTypeDescriptionDefault
modifierModifierCompose layout modifier applied to the root card container.Modifier
cornerRadiusDpCorner rounding radius of the card boundary.12.dp (Ux4gRadius.Radius12)
backgroundColorColor?Background fill color (null defaults to theme surface).null
borderColorColorBorder stroke color outline.Color.Transparent
borderWidthDpThickness of the border outline stroke.0.dp
elevationDpDrop-shadow elevation depth.0.dp
isClickableBooleanWhen true or when onClick/onPressed is set, enables ripple touch clicks.false
onPressed(() -> Unit)?Tap callback handler when card is clicked.null
onClick(() -> Unit)?Alias for onPressed.null
directionUx4gCardDirectionLayout orientation: Ux4gCardDirection.Vertical or Ux4gCardDirection.Horizontal.Ux4gCardDirection.Vertical
mediaImageUrlString?Remote image URL for full-bleed top banner (vertical) or left thumbnail (horizontal).null
mediaHeightDpHeight of media image in Vertical layout mode.180.dp
mediaWidthDpWidth of media image in Horizontal layout mode.120.dp
mediaLabelTextString?Optional text badge overlaid at the top-left of the media image.null
mediaLabelLeading(@Composable () -> Unit)?Leading icon or composable inside the media label badge.null
mediaTopEndAction(@Composable () -> Unit)?Action icon or button overlaid at the top-right of media.null
avatar(@Composable () -> Unit)?Composable avatar slot displayed at the left of the header row.null
titleString?Primary card headline title text.null
subtitleString?Secondary muted subtitle text below title.null
headerTrailing(@Composable () -> Unit)?Trailing action icon or button at the right side of header row.null
statusChipsList<String>List of inline metadata tags separated by vertical divider lines.emptyList()
statusContent(@Composable () -> Unit)?Custom composable slot replacing standard statusChips row.null
bodyString?Main description paragraph text.null
bodyTextString?Alias for body.null
bottomChipsList<String>List of rounded pill tags rendered below description.emptyList()
bottomChipsContent(@Composable () -> Unit)?Custom composable slot replacing standard bottomChips row.null
footerTypeUx4gCardFooterTypeButton layout: None, PrimaryOnly, SecondaryOnly, PrimaryAndSecondary.Ux4gCardFooterType.None
footerAlignmentUx4gCardFooterAlignmentHorizontal alignment: Left, Centered, Right.Ux4gCardFooterAlignment.Left
primaryButtonTextStringLabel text for the filled primary button."Confirm"
secondaryButtonTextStringLabel text for the outlined secondary button."Cancel"
onPrimaryClick(() -> Unit)?Click listener callback for the primary button.null
onSecondaryClick(() -> Unit)?Click listener callback for the secondary button.null
footerContent(@Composable () -> Unit)?Custom composable slot replacing default footer buttons.null
content(@Composable ColumnScope.() -> Unit)?Custom composable slot replacing entire structured card layout.null

Ux4gCardDirection Enum

DirectionVisual OrientationLayout Behavior
VerticalTop-to-BottomMedia banner placed on top, followed by full-width content column.
HorizontalLeft-to-RightMedia thumbnail pinned to left edge with intrinsic height, content on right.

Ux4gCardFooterType Enum

TypeButtons RenderedDescription
NoneNo buttonsNo footer row is displayed.
PrimaryOnlyFilled Primary ButtonSingle high-emphasis CTA button.
SecondaryOnlyOutlined Secondary ButtonSingle low/medium emphasis button.
PrimaryAndSecondaryPrimary & Outlined ButtonsDual-action row with primary action on left/first and outline on right/second.

Ux4gCardFooterAlignment Enum

AlignmentRow ArrangementBehavior
LeftArrangement.StartButtons aligned to the start/left edge.
CenteredArrangement.CenterButtons centered (or full width if single button).
RightArrangement.EndButtons aligned to the end/right edge.

On this page