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:
- Standard / Basic Card: Clean surface container with title, subtitle, description, and optional click interaction.
- Card with Action Buttons: Interactive card featuring customizable primary and secondary footer action buttons.
- Horizontal Card: Split-layout card with media thumbnail on the left and structured content on the right.
- 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.
- 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

2. Card with Footer Action Buttons
Ux4gCard - With Action ButtonsJetpack Compose

3. Horizontal Card (Ux4gCardDirection.Horizontal)
Ux4gCard - Horizontal OrientationJetpack Compose

4. Complex Vertical Card (Media, Avatar, Chips & Actions)
Ux4gCard - Complex Vertical BannerJetpack Compose

5. Complex Horizontal Card (Media, Avatar & Status Chips)
Ux4gCard - Complex Horizontal LayoutJetpack Compose

Kotlin Usage
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
| Prop | Type | Description | Default |
|---|---|---|---|
modifier | Modifier | Compose layout modifier applied to the root card container. | Modifier |
cornerRadius | Dp | Corner rounding radius of the card boundary. | 12.dp (Ux4gRadius.Radius12) |
backgroundColor | Color? | Background fill color (null defaults to theme surface). | null |
borderColor | Color | Border stroke color outline. | Color.Transparent |
borderWidth | Dp | Thickness of the border outline stroke. | 0.dp |
elevation | Dp | Drop-shadow elevation depth. | 0.dp |
isClickable | Boolean | When 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 |
direction | Ux4gCardDirection | Layout orientation: Ux4gCardDirection.Vertical or Ux4gCardDirection.Horizontal. | Ux4gCardDirection.Vertical |
mediaImageUrl | String? | Remote image URL for full-bleed top banner (vertical) or left thumbnail (horizontal). | null |
mediaHeight | Dp | Height of media image in Vertical layout mode. | 180.dp |
mediaWidth | Dp | Width of media image in Horizontal layout mode. | 120.dp |
mediaLabelText | String? | 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 |
title | String? | Primary card headline title text. | null |
subtitle | String? | Secondary muted subtitle text below title. | null |
headerTrailing | (@Composable () -> Unit)? | Trailing action icon or button at the right side of header row. | null |
statusChips | List<String> | List of inline metadata tags separated by vertical divider lines. | emptyList() |
statusContent | (@Composable () -> Unit)? | Custom composable slot replacing standard statusChips row. | null |
body | String? | Main description paragraph text. | null |
bodyText | String? | Alias for body. | null |
bottomChips | List<String> | List of rounded pill tags rendered below description. | emptyList() |
bottomChipsContent | (@Composable () -> Unit)? | Custom composable slot replacing standard bottomChips row. | null |
footerType | Ux4gCardFooterType | Button layout: None, PrimaryOnly, SecondaryOnly, PrimaryAndSecondary. | Ux4gCardFooterType.None |
footerAlignment | Ux4gCardFooterAlignment | Horizontal alignment: Left, Centered, Right. | Ux4gCardFooterAlignment.Left |
primaryButtonText | String | Label text for the filled primary button. | "Confirm" |
secondaryButtonText | String | Label 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
| Direction | Visual Orientation | Layout Behavior |
|---|---|---|
Vertical | Top-to-Bottom | Media banner placed on top, followed by full-width content column. |
Horizontal | Left-to-Right | Media thumbnail pinned to left edge with intrinsic height, content on right. |
Ux4gCardFooterType Enum
| Type | Buttons Rendered | Description |
|---|---|---|
None | No buttons | No footer row is displayed. |
PrimaryOnly | Filled Primary Button | Single high-emphasis CTA button. |
SecondaryOnly | Outlined Secondary Button | Single low/medium emphasis button. |
PrimaryAndSecondary | Primary & Outlined Buttons | Dual-action row with primary action on left/first and outline on right/second. |
Ux4gCardFooterAlignment Enum
| Alignment | Row Arrangement | Behavior |
|---|---|---|
Left | Arrangement.Start | Buttons aligned to the start/left edge. |
Centered | Arrangement.Center | Buttons centered (or full width if single button). |
Right | Arrangement.End | Buttons aligned to the end/right edge. |