Dialog
Description
The Dialog component is a modal overlay that is used to display temporary content and gather user confirmation or input. It blocks interaction with the underlying application until it is dismissed. This component is ideal for quick, actionable interactions requiring a decision, such as confirmation dialogs or small forms.
Usage
Dialogs are created with a fluent interface using the Tesserae.UI static helper. You can customize the dialog's header, content, and command buttons. Additional features include dark overlay and draggable mode. The example below initializes a dialog with a title, content, and custom command buttons.
API reference
public sealed class DialogA modal dialog with a title, body and configurable action buttons (OK / Cancel / custom).
- Namespace
- Tesserae
Constructors
| Name | Description |
|---|---|
| Dialog | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| IsDraggable | Gets or sets a value indicating whether the component can be dragged by the user. |
| IsDark | Gets or sets a value indicating whether the component uses the dark colour theme. |
public bool IsDraggable { get ; set ; }Gets or sets a value indicating whether the component can be dragged by the user.
Methods
| Name | Description |
|---|---|
| Title | Gets or sets the title of the component. |
| Content | Sets the content rendered inside the surface. |
| Commands | Adds the given components to the dialog's command row. |
| Dark | Applies the dark colour scheme to the component. |
| MinHeight | Gets or sets the CSS min-height of the component. |
| Height | Gets or sets the CSS height of the component. |
| Ok | Shows OK button actions on the dialog and wires up the callback. |
| OkCancel | Shows OK / Cancel button actions on the dialog and wires up the callbacks. |
| YesNo | Shows Yes / No button actions on the dialog and wires up the callbacks. |
| YesNoCancel | Shows Yes / No / Cancel button actions on the dialog and wires up the callbacks. |
| RetryCancel | Shows Retry / Cancel button actions on the dialog and wires up the callbacks. |
| Show | Shows the component. |
| Hide | Hides the component. |
| Draggable | Makes the surface draggable. |
| OkAsync | Awaitable variant of Ok that resolves with the user's response. |
| OkCancelAsync | Awaitable variant of OkCancel that resolves with the user's response. |
| YesNoAsync | Awaitable variant of YesNo that resolves with the user's response. |
| YesNoCancelAsync | Awaitable variant of YesNoCancel that resolves with the user's response. |
| RetryCancelAsync | Awaitable variant of RetryCancel that resolves with the user's response. |
public Dialog Content(IComponent content)Sets the content rendered inside the surface.
public Dialog Commands(params IComponent[] content)Adds the given components to the dialog's command row.
public Dialog MinHeight(UnitSize unitSize)Gets or sets the CSS min-height of the component.
public Dialog Height(UnitSize unitSize)Gets or sets the CSS height of the component.
public void Ok(Action onOk, Func<Button, Button> btnOk = null)Shows OK button actions on the dialog and wires up the callback.
public void OkCancel(Action onOk = null, Action onCancel = null, Func<Button, Button> btnOk = null, Func<Button, Button> btnCancel = null)Shows OK / Cancel button actions on the dialog and wires up the callbacks.
public void YesNo(Action onYes = null, Action onNo = null, Func<Button, Button> btnYes = null, Func<Button, Button> btnNo = null)Shows Yes / No button actions on the dialog and wires up the callbacks.
public void YesNoCancel(Action onYes = null, Action onNo = null, Action onCancel = null, Func<Button, Button> btnYes = null, Func<Button, Button> btnNo = null, Func<Button, Button> btnCancel = null)Shows Yes / No / Cancel button actions on the dialog and wires up the callbacks.
public void RetryCancel(Action onRetry = null, Action onCancel = null, Func<Button, Button> btnRetry = null, Func<Button, Button> btnCancel = null)Shows Retry / Cancel button actions on the dialog and wires up the callbacks.
public Task<Response> OkAsync(Func<Button, Button> btnOk = null)Awaitable variant of Ok that resolves with the user's response.
public Task<Response> OkCancelAsync(Func<Button, Button> btnOk = null, Func<Button, Button> btnCancel = null)Awaitable variant of OkCancel that resolves with the user's response.
public Task<Response> YesNoAsync(Func<Button, Button> btnYes = null, Func<Button, Button> btnNo = null)Awaitable variant of YesNo that resolves with the user's response.
public Task<Response> YesNoCancelAsync(Func<Button, Button> btnYes = null, Func<Button, Button> btnNo = null, Func<Button, Button> btnCancel = null)Awaitable variant of YesNoCancel that resolves with the user's response.
Samples
Basic Dialog Example
This sample demonstrates how to create a simple dialog with a title, content, and command buttons. It also shows how to enable draggable functionality.
Using Confirmation Methods
This sample illustrates the usage of the built-in confirmation methods such as YesNo and YesNoCancel.