UX4G Logo
Components

Button

Interactive standard Button suite featuring Fill (Primary/Secondary), Outline, Tonal, Text, and Icon Buttons with loading states and sizes

The UX4G Button suite provides modular composable buttons tailored for citizen self-service workflows, transaction confirmations, and utility actions:

  1. Fill Button (Ux4gButton): High-emphasis solid action buttons with Primary brand purple and Secondary styles.
  2. Outline Button (Ux4gOutlineButton): Medium-emphasis bordered buttons for secondary or cancel actions.
  3. Tonal Button (Ux4gButton with Tonal): Low-to-medium emphasis soft-tinted background button.
  4. Text Button (Ux4gTextButton): Clean ghost button without container or border, ideal for inline actions and links.
  5. Icon Button (Ux4gIconButton): Circular and rounded icon buttons in Filled, Outline, Text, and Tonal styles.

Import from com.ux4g.designsystemv1.components.buttons.*.


Interactive Previews

1. Fill Button (Primary & Secondary)

Ux4gButton - Fill (Primary & Secondary)Jetpack Compose
PrimaryUX4G Primary Button
SecondaryUX4G Secondary Button
LoadingUX4G Loading Button
DisabledUX4G Disabled Button

2. Outline Button (Ux4gOutlineButton)

Ux4gOutlineButton (Bordered Actions)Jetpack Compose
UX4G Outline Button Preview

3. Tonal Button (Ux4gButtonVariant.Tonal)

Ux4gButton - Tonal (Soft Tinted Fill)Jetpack Compose
UX4G Tonal Button Preview

4. Text / Ghost Button (Ux4gTextButton)

Ux4gTextButton (Clean Ghost Style)Jetpack Compose
UX4G Text Button Preview

5. Icon Button (Ux4gIconButton)

Ux4gIconButton (Styles & Shapes)Jetpack Compose
UX4G Icon Button Preview

Kotlin Usage

Button Showcase Example
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.ux4g.designsystemv1.components.buttons.Ux4gButton
import com.ux4g.designsystemv1.components.buttons.Ux4gButtonSize
import com.ux4g.designsystemv1.components.buttons.Ux4gButtonVariant
import com.ux4g.designsystemv1.components.buttons.Ux4gIconButton
import com.ux4g.designsystemv1.components.buttons.Ux4gIconButtonShape
import com.ux4g.designsystemv1.components.buttons.Ux4gIconButtonSize
import com.ux4g.designsystemv1.components.buttons.Ux4gIconButtonStyle
import com.ux4g.designsystemv1.components.buttons.Ux4gOutlineButton
import com.ux4g.designsystemv1.components.buttons.Ux4gTextButton
import com.ux4g.designsystemv1.theme.Ux4gTheme

@Composable
fun ButtonVariantsShowcase() {
    Column(
        modifier = Modifier.padding(16.dp),
        verticalArrangement = Arrangement.spacedBy(16.dp)
    ) {
        // 1. Fill Button (Primary)
        Ux4gButton(
            text = "Proceed to Authentication",
            onClick = { /* handle click */ },
            variant = Ux4gButtonVariant.Primary,
            size = Ux4gButtonSize.Large
        )

        // 2. Fill Button (Secondary)
        Ux4gButton(
            text = "Save as Draft",
            onClick = { /* handle click */ },
            variant = Ux4gButtonVariant.Secondary,
            size = Ux4gButtonSize.Medium
        )

        // 3. Outline Button
        Ux4gOutlineButton(
            text = "Cancel Application",
            onClick = { /* handle click */ },
            size = Ux4gButtonSize.Medium
        )

        // 4. Tonal Button
        Ux4gButton(
            text = "Explore Services",
            onClick = { /* handle click */ },
            variant = Ux4gButtonVariant.Tonal,
            size = Ux4gButtonSize.Medium
        )

        // 5. Text Button
        Ux4gTextButton(
            text = "Skip for Now",
            onClick = { /* handle click */ },
            size = Ux4gButtonSize.Small
        )

        // 6. Icon Buttons in a Row
        Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {
            Ux4gIconButton(
                onClick = {},
                type = Ux4gIconButtonStyle.Filled,
                shape = Ux4gIconButtonShape.Round,
                size = Ux4gIconButtonSize.L
            ) { Text("+", style = Ux4gTheme.typography.hS_strong) }

            Ux4gIconButton(
                onClick = {},
                type = Ux4gIconButtonStyle.Outline,
                shape = Ux4gIconButtonShape.Rounded,
                size = Ux4gIconButtonSize.L
            ) { Text("⚙", style = Ux4gTheme.typography.hS_strong) }

            Ux4gIconButton(
                onClick = {},
                type = Ux4gIconButtonStyle.Tonal,
                shape = Ux4gIconButtonShape.Round,
                size = Ux4gIconButtonSize.L
            ) { Text("↗", style = Ux4gTheme.typography.hS_strong) }

            Ux4gIconButton(
                onClick = {},
                type = Ux4gIconButtonStyle.Text,
                size = Ux4gIconButtonSize.L
            ) { Text("✕", style = Ux4gTheme.typography.hS_strong) }
        }
    }
}

Parameters

1. Ux4gButton Props

PropTypeDescriptionDefault
onClick *() -> UnitCallback invoked when the button is clicked.—
modifierModifierCompose layout modifier applied to the button container.Modifier
textString?Label text displayed inside the button (required if content is not provided).null
variantUx4gButtonVariantVisual variant: Primary, Secondary, Outline, Text, Tonal.Ux4gButtonVariant.Primary
sizeUx4gButtonSizeHeight & padding preset: XS, Small, Medium, Large, XL.Ux4gButtonSize.Medium
enabledBooleanWhether button responds to user touch interactions.true
isLoadingBooleanReplaces label with progress spinner and disables interactions.false
backgroundColorColor?Custom background fill color override (null uses variant default).null
contentColorColor?Custom text and icon tint color override.null
disabledBackgroundColorColor?Custom background fill when disabled.null
disabledContentColorColor?Custom text / icon color when disabled.null
borderColorColor?Custom border stroke color (null uses variant default).null
borderWidthDp?Custom border thickness (null uses variant default).null
borderRadiusDpCorner rounding radius for button shape.8.dp (Ux4gRadius.Radius8)
elevationDpButton shadow elevation on surface.0.dp
contentPaddingPaddingValuesInner padding surrounding button contents.PaddingValues(size.horizontalPadding, size.verticalPadding)
leadingIcon(@Composable () -> Unit)?Optional composable icon displayed before the label text.null
trailingIcon(@Composable () -> Unit)?Optional composable icon displayed after the label text.null
iconSizeDpDimensions (width & height) of leading and trailing icons.18.dp
textStyleTextStyle?Custom typography style override (null uses size default).null
interactionSourceMutableInteractionSourceTracks interaction state changes (press, focus, hover).remember { MutableInteractionSource() }
content(@Composable RowScope.() -> Unit)?Custom composable slot replacing standard text / icon layout.null

2. Ux4gOutlineButton Props

PropTypeDescriptionDefault
onClick *() -> UnitCallback invoked when the button is clicked.—
modifierModifierCompose layout modifier.Modifier
textString?Label text displayed inside the button.null
sizeUx4gButtonSizeHeight & padding preset: XS, Small, Medium, Large, XL.Ux4gButtonSize.Medium
enabledBooleanInteractive touch state.true
isLoadingBooleanReplaces label with spinner and disables button.false
colorColor?Primary tint applied to text, border, and icons.null (uses theme primary)
borderWidthDp?Border thickness override.null (Ux4gBorderWidth.Thin)
borderRadiusDpCorner rounding radius.8.dp (Ux4gRadius.Radius8)
contentPaddingPaddingValuesInner content padding.PaddingValues(size.horizontalPadding, size.verticalPadding)
leadingIcon(@Composable () -> Unit)?Composable icon before text.null
trailingIcon(@Composable () -> Unit)?Composable icon after text.null
iconSizeDpLeading/trailing icon size.18.dp
textStyleTextStyle?Custom typography style override.null
interactionSourceMutableInteractionSourceInteraction state tracker.remember { MutableInteractionSource() }
content(@Composable RowScope.() -> Unit)?Custom composable slot.null

3. Ux4gTextButton Props

PropTypeDescriptionDefault
onClick *() -> UnitCallback invoked when the text button is clicked.—
modifierModifierCompose layout modifier.Modifier
textString?Label text displayed inside the ghost button.null
sizeUx4gButtonSizeSize dimensions preset.Ux4gButtonSize.Medium
enabledBooleanInteractive touch state.true
isLoadingBooleanShows loading spinner in place of text.false
contentColorColor?Custom text and icon tint color.null (uses theme primary)
borderRadiusDpRipple click boundary radius.8.dp (Ux4gRadius.Radius8)
contentPaddingPaddingValuesInner padding.PaddingValues(size.horizontalPadding, size.verticalPadding)
leadingIcon(@Composable () -> Unit)?Composable icon before text.null
trailingIcon(@Composable () -> Unit)?Composable icon after text.null
iconSizeDpLeading/trailing icon size.18.dp
textStyleTextStyle?Custom typography style override.null
interactionSourceMutableInteractionSourceInteraction state tracker.remember { MutableInteractionSource() }
content(@Composable RowScope.() -> Unit)?Custom composable slot.null

4. Ux4gIconButton Props

PropTypeDescriptionDefault
onClick *() -> UnitClick callback handler.—
icon *@Composable () -> UnitComposable icon content rendered inside button.—
modifierModifierCompose layout modifier.Modifier
sizeUx4gIconButtonSizeSize preset: XS (24dp), S (32dp), M (40dp), L (48dp), XL (56dp).Ux4gIconButtonSize.XL
shapeUx4gIconButtonShapeContainer shape: Round (Circle) or Rounded (8dp corner radius).Ux4gIconButtonShape.Round
typeUx4gIconButtonStyleVisual styling: Filled, Outline, Text, Tonal.Ux4gIconButtonStyle.Filled
enabledBooleanInteractive enabled touch state.true
isLoadingBooleanReplaces icon with circular progress spinner.false
containerColorColor?Custom container fill background color override.null
contentColorColor?Custom icon tint color override.null
disabledContainerColorColor?Custom background fill color when disabled.null
disabledContentColorColor?Custom icon tint color when disabled.null
borderColorColor?Custom border stroke color override.null
interactionSourceMutableInteractionSourceInteraction state tracker.remember { MutableInteractionSource() }

Ux4gButtonVariant Enum

VariantTone & FillBorderText / Icon ColorRecommended Context
PrimarySolid Brand Purple (#4A2BC2)NoneWhite (#FFFFFF)Primary high-priority action per screen (Submit, Proceed, Pay)
SecondarySolid Secondary Amber / GoldNoneDark / On-SecondarySecondary alternative actions (Save Draft, Next Step)
OutlineTransparent1.dp Brand PurpleBrand PurpleLow-emphasis complementary actions (Cancel, Back, Reset)
TextTransparentNoneBrand PurpleGhost actions, inline links, dialog footer dismissals
TonalSoft Tinted (primary50)NoneBrand PurpleLow-to-medium emphasis utility actions (Filters, Explore)

Ux4gButtonSize Enum

TokenHeightHorizontal PaddingVertical PaddingTypography Style
XS24.dp12.dp4.dp12.sp SemiBold
Small32.dp16.dp7.dpLabel Large (14.sp)
Medium40.dp20.dp10.dpLabel XL (15.sp)
Large48.dp24.dp14.dpLabel XL (15.sp)
XL56.dp28.dp16.dp16.sp SemiBold

Ux4gIconButtonSize Enum

TokenContainer SizeIcon Scale Size
XS24.dp12.dp
S32.dp16.dp
M40.dp20.dp
L48.dp24.dp
XL56.dp28.dp

Ux4gIconButtonStyle & Ux4gIconButtonShape

Enum ClassValueDescription
Ux4gIconButtonStyleFilledSolid primary container with contrasting icon.
Ux4gIconButtonStyleOutlineTransparent background with 1.dp primary border stroke.
Ux4gIconButtonStyleTextGhost button without container fill or border.
Ux4gIconButtonStyleTonalSoft tinted primary50 background container.
Ux4gIconButtonShapeRoundPerfect circular clipping (CircleShape).
Ux4gIconButtonShapeRoundedRounded rectangular clipping with 8.dp corner radius.

On this page