UX4G Logo
Components

Chips

Interactive Choice Chip, Filter Chip, Input Chip with dismiss button, InputChipField with text/dropdown suggestions, and ChipGroup layouts

The UX4G Chips suite provides compact interactive elements for selection, filtering, dynamic tag inputs, and categorical tagging:

  1. Choice Chip (Ux4gChoiceChip): Single or multiple select chips with solid primary active fill, icons, and custom colors.
  2. Filter Chip (Ux4gFilterChip): Subtle filter toggles with soft 8% primary tint and primary text on selection.
  3. Input Chip (Ux4gInputChip): Removable tag chips with leading avatar/icon and a trailing dismiss (✕) button in XS, S, M sizes.
  4. Input Chip Field (Ux4gInputChipField): Comprehensive text or dropdown input container allowing citizens to add and manage dynamic chips.
  5. Chip Group (Ux4gChipGroup): Layout container supporting horizontal scroll or wrapping multi-line flow layouts.

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


Interactive Previews

1. Choice Chip (Ux4gChoiceChip)

Ux4gChoiceChip (Solid Fill on Selection)Jetpack Compose
UX4G Choice Chip Preview

2. Filter Chip (Ux4gFilterChip)

Ux4gFilterChip (Soft Tinted Filter Toggle)Jetpack Compose
UX4G Filter Chip Preview

3. Input Chip (Ux4gInputChip)

Ux4gInputChip (Dismissible Tag Chips)Jetpack Compose
UX4G Input Chip Preview

4. Input Chip Field (Ux4gInputChipField)

Ux4gInputChipField (Dynamic Text & Dropdown Input)Jetpack Compose
UX4G Input Chip Field Preview

5. Chip Group (Ux4gChipGroup)

Ux4gChipGroup (Horizontal & Wrap Arrangements)Jetpack Compose
UX4G Chip Group Preview

Kotlin Usage

Chips Showcase Example
import androidx.compose.foundation.layout.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Person
import androidx.compose.material.icons.filled.Star
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.ux4g.designsystemv1.components.chips.*
import com.ux4g.designsystemv1.foundation.Ux4gColors
import com.ux4g.designsystemv1.foundation.defaultTypography

@Composable
fun ChipsShowcaseScreen() {
    Column(
        modifier = Modifier.padding(16.dp),
        verticalArrangement = Arrangement.spacedBy(20.dp)
    ) {
        // 1. Choice Chips
        Text("Choice Chips", style = defaultTypography.hS_default)
        Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
            var choice1 by remember { mutableStateOf(true) }
            Ux4gChoiceChip(
                text = "Selected",
                selected = choice1,
                onClick = { choice1 = !choice1 },
                leadingContent = {
                    Icon(Icons.Default.Check, null, Modifier.size(16.dp), tint = Ux4gColors.neutral50)
                }
            )
            Ux4gChoiceChip(text = "Unselected", selected = false, onClick = {})
            Ux4gChoiceChip(
                text = "Small",
                selected = true,
                size = Ux4gChoiceChipSize.S,
                onClick = {},
                trailingContent = {
                    Icon(Icons.Default.Star, null, Modifier.size(12.dp), tint = Ux4gColors.neutral50)
                }
            )
        }

        // 2. Filter Chips
        Text("Filter Chips", style = defaultTypography.hS_default)
        Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
            var filter1 by remember { mutableStateOf(true) }
            Ux4gFilterChip(text = "Selected", selected = filter1, onClick = { filter1 = !filter1 })
            Ux4gFilterChip(text = "Unselected", selected = false, onClick = {})
            Ux4gFilterChip(text = "Small Filter", selected = true, size = Ux4gFilterChipSize.S, onClick = {})
        }

        // 3. Input Chips
        Text("Input Chips", style = defaultTypography.hS_default)
        Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
            Ux4gInputChip(
                text = "Medium",
                onDismiss = {},
                leadingContent = {
                    Icon(Icons.Default.Person, null, Modifier.size(16.dp), tint = Ux4gColors.neutral700)
                }
            )
            Ux4gInputChip(text = "Small", onDismiss = {}, size = Ux4gInputChipSize.S)
            Ux4gInputChip(text = "XS Chip", onDismiss = {}, size = Ux4gInputChipSize.XS)
        }

        // 4. Input Chip Field
        Text("Input Chip Field", style = defaultTypography.hS_default)
        var inputVal by remember { mutableStateOf("") }
        val tags = remember { mutableStateListOf("Aadhaar", "PAN Card", "Voter ID") }
        Ux4gInputChipField(
            value = inputVal,
            onValueChange = { inputVal = it },
            placeholder = "Add required document...",
            onAddChip = { tags.add(it) },
            chips = tags.map { tag ->
                { Ux4gInputChip(text = tag, onDismiss = { tags.remove(tag) }) }
            }
        )
    }
}

Parameters

1. Ux4gChoiceChip Props

PropTypeDescriptionDefault
text *StringLabel text displayed inside the choice chip.—
selected *BooleanWhether the chip is currently active/selected.—
onClick *() -> UnitClick callback handler.—
modifierModifierCompose layout modifier.Modifier
enabledBooleanInteractive touch state.true
sizeUx4gChoiceChipSizeDimension preset: S (Small) or M (Medium).Ux4gChoiceChipSize.M
leadingContent(@Composable () -> Unit)?Optional composable icon/slot before label text.null
trailingContent(@Composable () -> Unit)?Optional composable icon/slot after label text.null
borderRadiusDpCorner rounding radius.4.dp (Ux4gRadius.Radius4)
selectedBackgroundColorColor?Background fill when selected (null uses Ux4gColors.primary).null
unselectedBackgroundColorColor?Background fill when unselected (null uses white surface).null
selectedBorderColorColor?Border color when selected.null
unselectedBorderColorColor?Border color when unselected (null uses onSurface 20%).null
selectedTextColorColor?Text color when selected (null uses white #FFFFFF).null
unselectedTextColorColor?Text color when unselected (null uses dark onSurface).null
selectedBorderWidthDpBorder thickness when selected.1.dp
unselectedBorderWidthDpBorder thickness when unselected.1.dp

2. Ux4gFilterChip Props

PropTypeDescriptionDefault
text *StringFilter category text label.—
selected *BooleanSelection state of the filter chip.—
onClick *() -> UnitClick callback handler.—
modifierModifierCompose layout modifier.Modifier
enabledBooleanInteractive touch state.true
sizeUx4gFilterChipSizeDimension preset: S (28dp height) or M (32dp height).Ux4gFilterChipSize.M
leadingContent(@Composable () -> Unit)?Optional composable icon before filter text.null
borderRadiusDpCorner rounding radius.4.dp (Ux4gRadius.Radius4)
selectedBackgroundColorColor?Background fill when selected (null uses primary 8% alpha).null
unselectedBackgroundColorColor?Background fill when unselected (null uses surface).null
selectedBorderColorColor?Border color when selected.null
unselectedBorderColorColor?Border color when unselected.null
selectedTextColorColor?Text color when selected (null uses primary purple).null
unselectedTextColorColor?Text color when unselected.null
selectedBorderWidthDpBorder thickness when selected.1.dp
unselectedBorderWidthDpBorder thickness when unselected.1.dp

3. Ux4gInputChip Props

PropTypeDescriptionDefault
text *StringTag text label displayed inside chip.—
onDismiss *() -> UnitCallback invoked when citizen taps the trailing dismiss (✕) icon.—
modifierModifierCompose layout modifier.Modifier
enabledBooleanInteractive touch state.true
sizeUx4gInputChipSizePreset dimensions: XS (20dp), S (28dp), M (32dp).Ux4gInputChipSize.M
leadingContent(@Composable () -> Unit)?Optional leading composable slot (e.g. avatar or icon).null
borderRadiusDpCorner rounding radius.4.dp (Ux4gRadius.Radius4)
backgroundColorColor?Container background fill color override.null
borderColorColor?Border outline stroke color.null
textColorColor?Typography text color.null
borderWidthDpBorder thickness.1.dp

4. Ux4gInputChipField Props

PropTypeDescriptionDefault
value *StringCurrent text value in the input field.—
onValueChange *(String) -> UnitCallback when text changes.—
onAddChip *(String) -> UnitCallback invoked when citizen submits/clicks add or selects an option.—
modifierModifierCompose layout modifier.Modifier
placeholderStringPlaceholder text when input is empty."Please select.."
leadingIcon(@Composable () -> Unit)?Optional icon composable at start of input field.null
isDropdownBooleanWhen true, displays a selectable dropdown menu instead of raw text input.false
dropdownOptionsList<String>List of selectable choices when isDropdown = true.emptyList()
chipsList<@Composable () -> Unit>List of chip composable items to render below the field.emptyList()
arrangementUx4gChipGroupArrangementLayout for child chips: Horizontal or Wrap.Ux4gChipGroupArrangement.Horizontal

5. Ux4gChipGroup Props

PropTypeDescriptionDefault
chips *List<@Composable () -> Unit>List of chip composables to render in the group.—
modifierModifierCompose layout modifier.Modifier
arrangementUx4gChipGroupArrangementLayout arrangement: Horizontal (scrollable row) or Wrap (FlowRow).Ux4gChipGroupArrangement.Horizontal
spacingDpHorizontal spacing between adjacent chips.8.dp
runSpacingDpVertical spacing between consecutive lines in Wrap mode.8.dp

Token & Enum Tables

Ux4gChoiceChipSize & Ux4gFilterChipSize

Size TokenChoice Chip PaddingFilter Chip Height & PaddingTypography
S (Small)Horizontal: 12dp, Vertical: 6dpHeight: 28dp, Horizontal: 12dpLabel Medium (12.sp)
M (Medium)Horizontal: 16dp, Vertical: 8dpHeight: 32dp, Horizontal: 16dpLabel Large (14.sp)

Ux4gInputChipSize

Size TokenContainer HeightHorizontal PaddingIcon SizeTypography
XS20.dp8.dp12.dpLabel Small (11.sp)
S28.dp12.dp16.dpLabel Medium (12.sp)
M32.dp16.dp16.dpLabel Large (14.sp)

Ux4gChipGroupArrangement

ValueBehavior
HorizontalSingle-line horizontally-scrollable row (Row + horizontalScroll).
WrapMulti-line wrapping layout (FlowRow with vertical runSpacing).

On this page