Skip to content

SusPromptDialog

SusPromptDialog

Text prompt card for modal dialogs — single text field with Confirm/Cancel actions; awaitable ShowAsync resolves to the entered string (or null on cancel).

Package

SusKit · Molecules (commercial)

Open in Playground

SusKit · Molecules

Props

NameTypeDefault
TitleProp<string>"Prompt"
PlaceholderProp<string>""v-model
ConfirmLabelProp<string>"OK"
CancelLabelProp<string>"Cancel"
ValueProp<string>""v-model

Slots

No slots.

Events

NameFieldPayload
ConfirmOnConfirmstring
CancelOnCancel

Style hooks

USS class contract — override appearance without touching C#. States toggle via these classes:

  • sus-prompt-dialog
  • sus-prompt-dialog__footer

Usage

xml
<template>
  <sus:SusPromptDialog Title="Rename loadout"
                       Placeholder="Loadout name"
                       :Value="Name.Value"
                       @confirm="OnConfirm"
                       @cancel="OnCancel" />
</template>

<script>
public Prop<string> Name = new("");
void OnConfirm(string value) { /* value == current textfield content */ }
void OnCancel() { }
</script>
csharp
// Awaitable helper — hosts the card inside a SusModal and resolves when it closes.
string name = await SusPromptDialog.ShowAsync(
    title: "Rename loadout", placeholder: "Loadout name", initialValue: "Scout");
if (name != null) { /* confirmed, name is the entered text */ }

Notes

  • Value seeds the inner SusTextfield (outlined / comfortable) and stays mirrored two-way while the dialog is mounted — read it back after OnConfirm, or use the fired value directly.
  • OnConfirm(string) fires with the current textfield value on the confirm button; OnCancel() fires on the cancel button.
  • The static ShowAsync helper wraps the card in a SusModal host via SusModalService and resolves to null when the dialog is dismissed through the modal scrim.