Draft Status
Real-time draft auto-save banners, expiration countdown alerts, and application resume cards for multi-step government forms
The UX4G Draft Status and Status Banner components communicate live draft state, auto-save synchronization progress, and expiration countdown warnings during multi-step citizen application flows.
Key Capabilities
- Auto-Save Feedback: Real-time feedback transitions across saving (
SavingLightwith loader), saved confirmation (SuccessLightwith check icon), and idle states. - Expiration Alerts: Timed warning banners for draft expiry (
WarningLightwith date pill,WarningSolidfor imminent 24-hour urgency, andErrorLightfor expired drafts with recovery actions). - Application Draft Cards: High-density expandable draft cards featuring stage step tags, timestamps, and quick action CTAs ("Resume", "Discard").
- Banner Host Overlay: Built-in animated floating banner host (
Ux4gBannerHost) with auto-dismiss timers.
Import from:
import com.ux4g.designsystemv1.components.statusbanner.*Interactive Previews
1. Application Draft Progress Card
Displays an active draft application with step progress badge, last saved timestamp, and expandable details.

2. Auto-Save & Expiration Urgency Banners
Showcases critical urgency alert banners (WarningSolid), live saving loaders (SavingLight), and success save confirmations (SuccessLight).

3. Expiration Warnings & Action Recovery Banners
Illustrates countdown deadline warnings with date tags (WarningLight), expired draft notices with recovery actions (ErrorLight), and compact success tags.

Complete Kotlin Implementation
1. Form Auto-Save State Controller
import androidx.compose.foundation.layout.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.CheckCircle
import androidx.compose.material3.Icon
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.ux4g.designsystemv1.components.statusbanner.*
import com.ux4g.designsystemv1.components.loader.Ux4gLoader
import com.ux4g.designsystemv1.foundation.Ux4gColors
enum class AutoSaveStatus {
Idle,
Saving,
Saved,
Error
}
@Composable
fun AutoSaveIndicator(status: AutoSaveStatus, lastSavedTime: String) {
when (status) {
AutoSaveStatus.Saving -> {
Ux4gStatusBanner(
variant = Ux4gBannerVariant.WarningLight,
title = "Saving draft...",
trailingIcon = {
Ux4gLoader(size = 16.dp, strokeWidth = 2.dp, color = Ux4gColors.primary)
}
)
}
AutoSaveStatus.Saved -> {
Ux4gStatusBanner(
variant = Ux4gBannerVariant.SuccessLight,
title = "Draft saved successfully at $lastSavedTime",
leadingIcon = {
Icon(Icons.Default.CheckCircle, contentDescription = null, tint = Ux4gColors.green600)
}
)
}
AutoSaveStatus.Error -> {
Ux4gStatusBanner(
variant = Ux4gBannerVariant.ErrorLight,
title = "Failed to save draft. Check connection.",
onDismiss = { /* retry or dismiss */ }
)
}
AutoSaveStatus.Idle -> { /* hidden */ }
}
}2. Imminent Expiration Warning with Floating Banner Host
import androidx.compose.runtime.*
import com.ux4g.designsystemv1.components.statusbanner.*
@Composable
fun ApplicationScreenWithDraftAlert(bannerHostState: Ux4gBannerHostState) {
LaunchedEffect(Unit) {
bannerHostState.show(
Ux4gBannerData(
variant = Ux4gBannerVariant.WarningSolid,
title = "Your draft expires tomorrow. Submit today",
subtitle = "Incomplete forms are automatically purged after 15 days of inactivity.",
autoDismiss = false
)
)
}
Ux4gBannerHost(hostState = bannerHostState)
}Parameters & API Reference
1. Ux4gStatusBanner Composable (Inline Banner)
| Prop | Type | Description | Default |
|---|---|---|---|
variant * | Ux4gBannerVariant | Visual style variant (WarningLight, WarningSolid, ErrorLight, SuccessLight, etc.). | — |
title * | String | Primary header headline text. | — |
modifier | Modifier | Compose modifier applied to the outer layout. | Modifier |
subtitle | String? | Optional explanatory body text below the title. | null |
subtitleWidget | (@Composable () -> Unit)? | Custom composable override for the subtitle area. | null |
titleStyle | TextStyle? | Custom typography style override for the title text. | null |
subtitleStyle | TextStyle? | Custom typography style override for the subtitle text. | null |
badge | (@Composable () -> Unit)? | Optional tag / badge composable placed inline next to the title. | null |
leadingIcon | (@Composable () -> Unit)? | Optional leading status icon composable. | null |
trailingIcon | (@Composable () -> Unit)? | Optional trailing graphic or action text composable. | null |
actions | (@Composable () -> Unit)? | Action buttons / CTAs rendered inside the banner. | null |
onDismiss | (() -> Unit)? | Callback triggered when the default close icon is clicked. | null |
backgroundColor | Color? | Custom background color override. | null |
borderColor | Color? | Custom border stroke color override. | null |
actionsAlignment | Arrangement.Horizontal | Layout alignment for action buttons. | Arrangement.Start |
width | Dp? | Explicit width constraint. | null |
height | Dp? | Explicit height constraint (minimum height is 48.dp). | null |
margin | PaddingValues | Outer margin around the banner container. | PaddingValues(horizontal = 16.dp, vertical = 8.dp) |
padding | PaddingValues | Inner padding inside the banner card. | PaddingValues(horizontal = 16.dp, vertical = 12.dp) |
2. Ux4gBannerHost Composable (Floating Container)
| Prop | Type | Description | Default |
|---|---|---|---|
hostState * | Ux4gBannerHostState | State controller managing floating banner display, transitions, and dismissal. | — |
modifier | Modifier | Compose layout modifier applied to the banner host overlay container. | Modifier |
3. Ux4gBannerData Data Model
Passed into bannerHostState.show(Ux4gBannerData(...)) to display a dynamic overlay banner.
| Field | Type | Description | Default |
|---|---|---|---|
variant * | Ux4gBannerVariant | Visual semantic tone (WarningLight, WarningSolid, ErrorLight, SuccessLight, etc.). | — |
title * | String | Primary headline text for the floating banner. | — |
subtitle | String? | Optional body description text providing further context. | null |
autoDismiss | Boolean | When true, automatically dismisses the banner after durationMillis. | false |
durationMillis | Long | Display duration before auto-dismissal when autoDismiss = true. | 4000L |
onDismiss | (() -> Unit)? | Callback triggered when the banner is dismissed or closed. | null |
4. Ux4gBannerVariant Reference Guide
| Variant | Background Color | Text / Icon Color | Context & Best Practice |
|---|---|---|---|
WarningLight | Light Amber (12% orange600) | neutral900 / orange600 | Expiration countdowns, draft warnings, soft prerequisites |
WarningSolid | Solid Orange (orange600) | White (neutral0) | Imminent deadline alerts, urgent 24h expiration warnings |
ErrorLight | Light Red (12% red600) | neutral900 / red600 | Expired drafts, failed auto-save sync, validation blocks |
SuccessLight | Light Green (12% green600) | neutral900 / green600 | Successful draft saved confirmations, upload sync success |
SavingLight | Light Primary (12% primary) | neutral900 / primary | Live background auto-save synchronization spinner |
InfoLight | Light Blue (12% blue600) | neutral900 / blue600 | General guidelines, document checklist reminders |
NeutralLight | Translucent Gray (5% neutral900) | neutral900 | Non-urgent system notes, informational banners |
PrimaryLight | Light Primary (12% primary) | neutral900 / primary | Feature updates and account confirmations |