DialogList
Displays a dialog containing a selectable or clickable list of items.
This overload is intended for already available item lists.
Each item is identified by key. The key is also used by selectionMode to determine and update the selected item state.
The content slot receives the item and an DialogList.ItemContext. Custom item implementations should use the context to read the current selection state and call DialogList.ItemContext.performItemAction whenever the item is activated by the user.
Parameters
Controls the visibility and lifecycle of the dialog.
The items displayed in the dialog.
Returns a stable unique identifier for an item. The identifier is also used internally for selection handling.
Composable used to render an item. Receives both the item and its associated DialogList.ItemContext.
Defines how item interactions and selection are handled.
Optional divider displayed between list items. By default, no dividers are shown.
Optional text displayed above the list content.
Optional filter configuration used to filter visible items.
Optional dialog title.
Optional dialog icon displayed next to the title.
Defines the visual appearance of the dialog.
Defines the dialog buttons.
Additional dialog configuration options.
Callback invoked for dialog events.
Example:
DialogList(
state = state,
items = users,
key = { it.id },
selectionMode = DialogList.SelectionMode.MultiSelect(
selected = selectedUserIds
),
content = DialogListDefaults.itemContent(
text = { Text(it.name) },
supportingText = { Text(it.email) }
),
title = {
Text("Select users")
}
)Displays a dialog containing a selectable or clickable list of items loaded asynchronously.
This overload is useful when the list content has to be loaded when the dialog is shown. Until loading is complete, loadingIndicator is displayed.
If itemSaver is provided, the loaded items are stored using rememberSaveable. This can be useful when the dialog should preserve loaded data across configuration changes or process recreation.
Each item is identified by key. The key is also used by selectionMode to determine and update the selected item state.
The content slot receives the item and an DialogList.ItemContext. Custom item implementations should use the context to read the current selection state and call DialogList.ItemContext.performItemAction whenever the item is activated by the user.
Parameters
Controls the visibility and lifecycle of the dialog.
Suspended function used to load the items displayed in the dialog.
Returns a stable unique identifier for an item. The identifier is also used internally for selection handling.
Composable used to render an item. Receives both the item and its associated DialogList.ItemContext.
Defines how item interactions and selection are handled.
Optional saver used to persist loaded items across state restoration.
Composable displayed while items are being loaded.
Optional divider displayed between list items. By default, no dividers are shown.
Optional text displayed above the list content.
Optional filter configuration used to filter visible items.
Optional dialog title.
Optional dialog icon displayed next to the title.
Defines the visual appearance of the dialog.
Defines the dialog buttons.
Additional dialog configuration options.
Callback invoked for dialog events.
Example:
DialogList(
state = state,
items = {
repository.loadUsers()
},
key = { it.id },
selectionMode = DialogList.SelectionMode.SingleSelect(
selected = selectedUserId
),
content = DialogListDefaults.itemContent(
text = { Text(it.name) },
supportingText = { Text(it.email) }
),
title = {
Text("Select user")
}
)