UX4G Logo
Components

Dropdown

Interactive Action Dropdown menus and Selection Dropdown fields supporting Single select, Multi-select with chips, and search filtering

The UX4G Dropdown suite provides production-ready menu and selection systems designed for citizen forms, administrative actions, and filter toolbars:

  1. Action Dropdown (Ux4gActionDropdown): Triggerable context menu attached to buttons or icons with trailing navigation arrows and active checkmark items.
  2. Single Selection Dropdown (Ux4gSelectionDropdown): Accessible form field with type-ahead search filter, status feedback, and custom leading icons.
  3. Multi-Selection Dropdown (Ux4gSelectionDropdown): Multi-choice selection menu with checkboxes and integrated dismissible input chips in the trigger container.

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


Interactive Previews

1. Action Dropdown (Ux4gActionDropdown)

Ux4gActionDropdown (Contextual Actions Menu)Jetpack Compose
UX4G Action Dropdown Preview

2. Selection Dropdown - Single Select

Ux4gSelectionDropdown (Single Select)Jetpack Compose
UX4G Single Select Dropdown Preview

3. Selection Dropdown - Multi-Select with Chips

Ux4gSelectionDropdown (Multi-Select with Integrated Chips and search)Jetpack Compose
UX4G Multi-Select Dropdown Preview

Kotlin Usage

Dropdown Showcase Example
import androidx.compose.foundation.layout.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.MoreVert
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.buttons.Ux4gIconButton
import com.ux4g.designsystemv1.components.buttons.Ux4gIconButtonSize
import com.ux4g.designsystemv1.components.buttons.Ux4gIconButtonStyle
import com.ux4g.designsystemv1.components.dropdowns.*
import com.ux4g.designsystemv1.foundation.Ux4gColors
import com.ux4g.designsystemv1.foundation.defaultTypography

@Composable
fun DropdownShowcaseScreen() {
    Column(
        modifier = Modifier
            .fillMaxWidth()
            .padding(16.dp),
        verticalArrangement = Arrangement.spacedBy(20.dp)
    ) {
        val sampleOptions = listOf(
            Ux4gDropdownOption("1", "English (India)"),
            Ux4gDropdownOption("2", "Hindi (हिन्दी)"),
            Ux4gDropdownOption("3", "Tamil (தமிழ்)"),
            Ux4gDropdownOption("4", "Bengali (বাংলা)")
        )

        // 1. Single Selection Dropdown
        Text("Single Selection Dropdown", style = defaultTypography.hS_strong)
        var singleSelect by remember { mutableStateOf(listOf("1")) }
        Ux4gSelectionDropdown(
            label = "Language Preference",
            isRequired = true,
            options = sampleOptions,
            selectedOptionIds = singleSelect,
            onSelectionChange = { singleSelect = it },
            searchEnabled = true,
            description = "Select primary language for citizen notifications"
        )

        // 2. Multi-Selection Dropdown
        Text("Multi-Selection Dropdown", style = defaultTypography.hS_strong)
        var multiSelect by remember { mutableStateOf(listOf("1", "2")) }
        Ux4gSelectionDropdown(
            label = "Notification Channels",
            options = listOf(
                Ux4gDropdownOption("sms", "SMS Alert"),
                Ux4gDropdownOption("email", "Email Digest"),
                Ux4gDropdownOption("whatsapp", "WhatsApp Updates"),
                Ux4gDropdownOption("inapp", "In-App Push")
            ),
            selectedOptionIds = multiSelect,
            onSelectionChange = { multiSelect = it },
            mode = Ux4gDropdownMode.Multi,
            description = "Choose communication preferences"
        )

        // 3. Validation Status State
        Text("Validation States", style = defaultTypography.hS_strong)
        Ux4gSelectionDropdown(
            label = "District (Mandatory)",
            options = emptyList(),
            selectedOptionIds = emptyList(),
            onSelectionChange = {},
            status = Ux4gDropdownStatus.Error,
            description = "Please select a valid district from the list"
        )
    }
}

Parameters

1. Ux4gSelectionDropdown Props

PropTypeDescriptionDefault
options *List<Ux4gDropdownOption>List of selectable dropdown options.—
selectedOptionIds *List<String>List of currently selected option ID keys.—
onSelectionChange *(List<String>) -> UnitCallback invoked when selection changes.—
modifierModifierCompose layout modifier applied to outer container.Modifier
labelString?Header title label displayed above input box.null
isRequiredBooleanWhen true, appends red asterisk (*) to the label.false
descriptionString?Supplementary helper or validation status message.null
placeholderStringHint text displayed when selection is empty."Please select.."
sizeUx4gDropdownSizeHeight & padding preset: S (32dp), M (40dp), L (48dp).Ux4gDropdownSize.M
modeUx4gDropdownModeSelection mode: Ux4gDropdownMode.Single or Ux4gDropdownMode.Multi.Ux4gDropdownMode.Single
statusUx4gDropdownStatusValidation tone: Default, Error, Warning, Success, Disabled.Ux4gDropdownStatus.Default
searchEnabledBooleanEnables type-ahead search input bar inside the popup menu.false
filterTypeUx4gDropdownFilterTypeMatch rule: Contains, StartsWith, StartsWithPerTerm.Ux4gDropdownFilterType.Contains
leadingIconImageVector?Optional leading icon rendered inside the trigger box.null

2. Ux4gActionDropdown Props

PropTypeDescriptionDefault
options *List<Ux4gActionDropdownOption>List of action items displayed in menu.—
onOptionClick *(Ux4gActionDropdownOption) -> UnitCallback invoked when citizen taps a menu item.—
triggerContent *@Composable (onClick: () -> Unit) -> UnitComposable trigger slot (e.g. Button or IconButton).—
modifierModifierCompose layout modifier.Modifier
selectedOptionIdString?ID of currently active option (renders checkmark).null

3. Data Models & Enums

Ux4gDropdownOption Data Class

PropTypeDescriptionDefault
id *StringUnique key identifier for the option.—
label *StringDisplay text string shown in trigger and menu.—
leadingIconAny?Optional ImageVector, Ux4gIcon, or drawable resource ID.null

Ux4gActionDropdownOption Data Class

PropTypeDescriptionDefault
id *StringUnique action key identifier.—
label *StringAction title text.—
showTrailingArrowBooleanDisplays chevron right navigation arrow (>).true

Ux4gDropdownMode & Ux4gDropdownSize

EnumValueDescription
Ux4gDropdownModeSingleSingle select mode closing popup on selection.
Ux4gDropdownModeMultiMulti-select mode with checkboxes and trigger chips.
Ux4gDropdownSizeSCompact 32dp height container.
Ux4gDropdownSizeMStandard 40dp height container.
Ux4gDropdownSizeLLarge 48dp height container.

On this page