Skip to content

ChoiceDialog

@Composable



fun <T> ModalScope.ChoiceDialog(
    title: Component, 
    message: Component? = null, 
    choices: List<ModalChoice<T>>, 
    cancelText: Component = Component.literal("Cancel"), 
    onSelected: (T) -> Unit, 
    onCancel: () -> Unit = {}
)

Multi-choice modal that maps each option in choices to its own button, plus one cancel action.

Parameters

  • title: The dialog's header text.

  • message: Optional body text shown above the choice buttons.

  • choices: The selectable options, one button each, in order.

  • cancelText: Label for the cancel button.

  • onSelected: Called with the chosen value just before the modal dismisses itself.

  • onCancel: Called just before the modal dismisses itself via the cancel button.