SusChoiceDialog

N-button choice card for modal dialogs — buttons render in order, awaitable ShowAsync resolves to the chosen index (or -1 on dismiss).
Package
SusKit · Molecules (commercial)
Props
| Name | Type | Default | |
|---|---|---|---|
Title | Prop<string> | "Choose" | |
Message | Prop<string> | "" | v-model |
Buttons | Prop<string[]> | Array.Empty<string>() | |
ButtonIds | Prop<string[]> | Array.Empty<string>() |
Slots
No slots.
Events
| Name | Field | Payload |
|---|---|---|
Choose | OnChoose | int |
ChooseId | OnChooseId | string |
Style hooks
USS class contract — override appearance without touching C#. States toggle via these classes:
sus-choice-dialogsus-choice-dialog__btnsus-choice-dialog__buttons
Usage
xml
<template>
<sus:SusChoiceDialog Title="Delete item?"
Message="This cannot be undone."
:Buttons="Options.Value"
@choose="OnChoose" />
</template>
<script>
public Prop<string[]> Options = new(new[] { "Cancel", "Delete" });
void OnChoose(int index) { /* index == Options.Value.Length - 1 → confirmed */ }
</script>csharp
// Awaitable helper — hosts the card inside a SusModal and resolves when it closes.
int index = await SusChoiceDialog.ShowAsync(
"Delete item?", "This cannot be undone.", "Cancel", "Delete");
if (index == 1) { /* confirmed */ }Notes
- The last entry in
Buttonsrenders as the primary action (elevated/primarycolor); every other entry rendersoutlined/secondary— put the confirming choice last. OnChoose(int)fires with the clicked index.ButtonIdsis an optional array parallel toButtons— when the clicked button has a matching id,OnChooseId(string)fires alongside it, so callers can key off a stable id instead of a position.- The static
ShowAsynchelper wraps the card in aSusModalhost viaSusModalServiceand resolves to-1when the dialog is dismissed through the modal scrim without a button click.