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:
- Action Dropdown (
Ux4gActionDropdown): Triggerable context menu attached to buttons or icons with trailing navigation arrows and active checkmark items. - Single Selection Dropdown (
Ux4gSelectionDropdown): Accessible form field with type-ahead search filter, status feedback, and custom leading icons. - 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

2. Selection Dropdown - Single Select
Ux4gSelectionDropdown (Single Select)Jetpack Compose

3. Selection Dropdown - Multi-Select with Chips
Ux4gSelectionDropdown (Multi-Select with Integrated Chips and search)Jetpack Compose

Kotlin Usage
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
| Prop | Type | Description | Default |
|---|---|---|---|
options * | List<Ux4gDropdownOption> | List of selectable dropdown options. | — |
selectedOptionIds * | List<String> | List of currently selected option ID keys. | — |
onSelectionChange * | (List<String>) -> Unit | Callback invoked when selection changes. | — |
modifier | Modifier | Compose layout modifier applied to outer container. | Modifier |
label | String? | Header title label displayed above input box. | null |
isRequired | Boolean | When true, appends red asterisk (*) to the label. | false |
description | String? | Supplementary helper or validation status message. | null |
placeholder | String | Hint text displayed when selection is empty. | "Please select.." |
size | Ux4gDropdownSize | Height & padding preset: S (32dp), M (40dp), L (48dp). | Ux4gDropdownSize.M |
mode | Ux4gDropdownMode | Selection mode: Ux4gDropdownMode.Single or Ux4gDropdownMode.Multi. | Ux4gDropdownMode.Single |
status | Ux4gDropdownStatus | Validation tone: Default, Error, Warning, Success, Disabled. | Ux4gDropdownStatus.Default |
searchEnabled | Boolean | Enables type-ahead search input bar inside the popup menu. | false |
filterType | Ux4gDropdownFilterType | Match rule: Contains, StartsWith, StartsWithPerTerm. | Ux4gDropdownFilterType.Contains |
leadingIcon | ImageVector? | Optional leading icon rendered inside the trigger box. | null |
2. Ux4gActionDropdown Props
| Prop | Type | Description | Default |
|---|---|---|---|
options * | List<Ux4gActionDropdownOption> | List of action items displayed in menu. | — |
onOptionClick * | (Ux4gActionDropdownOption) -> Unit | Callback invoked when citizen taps a menu item. | — |
triggerContent * | @Composable (onClick: () -> Unit) -> Unit | Composable trigger slot (e.g. Button or IconButton). | — |
modifier | Modifier | Compose layout modifier. | Modifier |
selectedOptionId | String? | ID of currently active option (renders checkmark). | null |
3. Data Models & Enums
Ux4gDropdownOption Data Class
| Prop | Type | Description | Default |
|---|---|---|---|
id * | String | Unique key identifier for the option. | — |
label * | String | Display text string shown in trigger and menu. | — |
leadingIcon | Any? | Optional ImageVector, Ux4gIcon, or drawable resource ID. | null |
Ux4gActionDropdownOption Data Class
| Prop | Type | Description | Default |
|---|---|---|---|
id * | String | Unique action key identifier. | — |
label * | String | Action title text. | — |
showTrailingArrow | Boolean | Displays chevron right navigation arrow (>). | true |
Ux4gDropdownMode & Ux4gDropdownSize
| Enum | Value | Description |
|---|---|---|
Ux4gDropdownMode | Single | Single select mode closing popup on selection. |
Ux4gDropdownMode | Multi | Multi-select mode with checkboxes and trigger chips. |
Ux4gDropdownSize | S | Compact 32dp height container. |
Ux4gDropdownSize | M | Standard 40dp height container. |
Ux4gDropdownSize | L | Large 48dp height container. |