UX4G Logo
Components

Empty State

Informative fallback view for zero search results, empty inboxes, offline errors, and upcoming features

The UX4G Empty State suite provides clean and informative fallback screens when data is absent, search filters return zero items, or network errors occur:

  1. Semantic Presets (Ux4gEmptyStateVariant): Automatic icon selection and typography for NoResults, NoData, ComingSoon, and Error.
  2. Actionable Call-to-Action: Integrated tonal button (e.g. "Clear all filters", "Refresh Inbox", "Try Again").
  3. Custom Content Slot: Support for custom illustrations, vector drawables, and additional action buttons.

Import from com.ux4g.designsystemv1.components.Ux4gEmptyState.


Interactive Preview

Ux4gEmptyState - Semantic Presets & ActionsJetpack Compose
UX4G Empty State Preview

Kotlin Usage

Empty State Showcase Example
import androidx.compose.foundation.layout.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.ux4g.designsystemv1.components.Ux4gEmptyState
import com.ux4g.designsystemv1.components.Ux4gEmptyStateVariant
import com.ux4g.designsystemv1.components.buttons.Ux4gButtonSize

@Composable
fun EmptyStateShowcaseScreen() {
    Column(
        modifier = Modifier
            .fillMaxWidth()
            .padding(16.dp),
        verticalArrangement = Arrangement.spacedBy(24.dp)
    ) {
        // Search Zero State
        Ux4gEmptyState(
            variant = Ux4gEmptyStateVariant.NoResults,
            title = "No applications found",
            subtitle = "Try adjusting your search criteria or explore popular citizen services.",
            buttonText = "Explore All Services",
            buttonSize = Ux4gButtonSize.Medium,
            onButtonPressed = { /* navigate to directory */ }
        )

        // Empty Inbox
        Ux4gEmptyState(
            variant = Ux4gEmptyStateVariant.NoData,
            title = "All Caught Up!",
            subtitle = "You have no unread notifications or pending actions.",
            buttonText = "Check Again",
            onButtonPressed = { /* refresh */ }
        )
    }
}

Parameters

Ux4gEmptyState Props

PropTypeDescriptionDefault
title *StringBold primary headline message displayed below icon.—
modifierModifierCompose layout modifier applied to outer column.Modifier
variantUx4gEmptyStateVariantSemantic preset controlling default icon selection.Ux4gEmptyStateVariant.Custom
iconAny?Custom icon override (ImageVector, Ux4gIcon, or drawable resource ID).null (uses variant default)
iconContent(@Composable () -> Unit)?Custom composable slot replacing the default icon.null
iconSizeDpSize dimensions (width & height) of the hero icon.48.dp
iconColorColor?Custom tint color for hero icon (null uses Ux4gColors.primary).null
subtitleString?Secondary subtitle text line.null
descriptionString?Tertiary explanatory description line.null
titleStyleTextStyle?Custom typography style override for title.null (hXXS_strong)
bodyStyleTextStyle?Custom typography style override for subtitle/description.null (bS_default)
buttonTextString?Label text for the filled tonal call-to-action button.null
onButtonPressed(() -> Unit)?Callback invoked when citizen taps the action button.null
buttonSizeUx4gButtonSizeSize dimensions of the action button: Small, Medium, Large.Ux4gButtonSize.Small
buttonLeadingIconAny?Optional leading icon rendered inside the action button.null
paddingPaddingValuesOuter padding surrounding the entire empty state container.PaddingValues(24.dp)
bodyHorizontalPaddingDpHorizontal padding applied to body text for optimal reading width.24.dp
customContent(@Composable () -> Unit)?Optional composable slot below body text.null

Ux4gEmptyStateVariant Enum

VariantDefault IconSemantic Use Case
NoResultsIcons.Default.SearchOffSearch or filter criteria returned 0 items.
NoDataIcons.Default.InboxList or inbox is currently empty.
ComingSoonIcons.Default.RocketLaunchNew service or feature under development.
ErrorIcons.Default.ErrorOutlineNetwork failure or server request error.
CustomIcons.Default.InfoFully customized empty state.

On this page