Description

The Modal component provides a temporary overlay window that can be used to display contextual information or gather user input. It is ideal for presenting dialogs, alerts, or small interactive forms within your application. The Modal belongs to the Surfaces group and offers both blocking and non-blocking modes, light dismiss behavior, customizable headers and footers, and various styling options.

Usage

Instantiate a Modal using the Tesserae.UI helper methods. You can optionally pass in a header component. The Modal supports chaining configuration methods such as adding a footer, enabling light dismiss, adjusting dimensions, and more.

API reference

ModalStack

A deck of modals shown as stacked sheets: the ones behind peek out above the one in front, clicking one goes back to it, Escape peels one off, and clicking the backdrop dismisses the chain. Each sheet carries the key it was pushed under and the short name the chain shows for it, so pushing the same key again replaces the sheet instead of stacking another copy.

class

ModalStackEntry

public sealed class ModalStackEntry

One sheet in the ModalStack: the modal, the key it was pushed under, and the name the chain shows for it.

Namespace
Tesserae

Properties

NameDescription
KeyGets what this sheet was pushed under - what makes it the same sheet on a later push.
NameGets the name the chain shows for this sheet - its title, in one short line.
ModalGets the modal this sheet shows.
Property
ModalStackEntry.Key
public string Key { get; }

Gets what this sheet was pushed under - what makes it the same sheet on a later push.

Property
ModalStackEntry.Name
public string Name { get; internal set; }

Gets the name the chain shows for this sheet - its title, in one short line.

Property
ModalStackEntry.Modal
public Modal Modal { get; }

Gets the modal this sheet shows.

class

ModalStack

public static class ModalStack

A stack of modals shown as a deck of sheets: the newest one in front, the ones it was opened from peeking out behind it, each a little smaller and quieter than the one in front of it. A sheet is pushed under a key (Push); pushing a key that is already in the stack rewinds to it rather than opening a second copy of the same thing. Clicking a peeking sheet goes back to it, Escape closes the sheet in front, and clicking the backdrop dismisses the whole chain. Past MaxDepth sheets the oldest one is dropped, so a chain of this-led-to-that never grows without end. The stack takes the modal's own surface and shows it itself, so Show is not what opens a stacked modal - Push is. Everything else about the modal still works: Hide pops it, and its show and hide handlers run as they would have.

Namespace
Tesserae

Properties

NameDescription
DepthGets how many sheets are open.
IsEmptyGets a value indicating whether nothing is open.
TopGets the sheet in front, or null when nothing is open.
IsTruncatedGets a value indicating whether the chain has had its oldest sheets dropped to stay within MaxDepth - which is worth saying in a breadcrumb, and nowhere else.
EntriesGets the open sheets, oldest first.
Property
ModalStack.Depth
public static int Depth

Gets how many sheets are open.

Property
ModalStack.IsEmpty
public static bool IsEmpty

Gets a value indicating whether nothing is open.

Property
ModalStack.Top
public static ModalStackEntry Top

Gets the sheet in front, or null when nothing is open.

Property
ModalStack.IsTruncated
public static bool IsTruncated

Gets a value indicating whether the chain has had its oldest sheets dropped to stay within MaxDepth - which is worth saying in a breadcrumb, and nowhere else.

Property
ModalStack.Entries
public static IReadOnlyList<ModalStackEntry> Entries

Gets the open sheets, oldest first.

Methods

NameDescription
ContainsReturns a value indicating whether a sheet is open under the given key.
GetReturns the sheet open under the given key, or null when there is none.
IsStackedReturns a value indicating whether the given modal is one of the open sheets - which is what tells a modal that answers Escape itself to leave the key to the stack instead.
PushOpens the given modal as the sheet in front, under the given key and showing the given name in the chain. Pushing a key that is already open rewinds to it instead - a chain that leads back to something already in it goes back to that sheet rather than opening a second copy of it.
ReplaceSwaps the sheet in front for another one, keeping the chain behind it as it was - what stepping through a list of results while one of them is open does. Pushes the modal when nothing is open.
RenameRenames the sheet open under the given key, for a sheet whose title is only known once its content has loaded.
TryRewindToGoes back to the sheet open under the given key, closing everything opened from it. Returns false - and changes nothing - when no sheet is open under that key.
PopCloses the sheet in front, going back to the one it was opened from.
PopToCloses everything opened from the sheet under the given key, leaving that sheet in front.
RemoveCloses the sheet showing the given modal, wherever it is in the chain, leaving the rest of the chain as it was.
ClearCloses the whole chain.
Method
ModalStack.Contains
public static bool Contains(string key)

Returns a value indicating whether a sheet is open under the given key.

Method
ModalStack.Get
public static ModalStackEntry Get(string key)

Returns the sheet open under the given key, or null when there is none.

Method
ModalStack.IsStacked
public static bool IsStacked(Modal modal)

Returns a value indicating whether the given modal is one of the open sheets - which is what tells a modal that answers Escape itself to leave the key to the stack instead.

Method
ModalStack.Push
public static void Push(string key, string name, Modal modal)

Opens the given modal as the sheet in front, under the given key and showing the given name in the chain. Pushing a key that is already open rewinds to it instead - a chain that leads back to something already in it goes back to that sheet rather than opening a second copy of it.

Method
ModalStack.Replace
public static void Replace(string key, string name, Modal modal)

Swaps the sheet in front for another one, keeping the chain behind it as it was - what stepping through a list of results while one of them is open does. Pushes the modal when nothing is open.

Method
ModalStack.Rename
public static void Rename(string key, string name)

Renames the sheet open under the given key, for a sheet whose title is only known once its content has loaded.

Method
ModalStack.TryRewindTo
public static bool TryRewindTo(string key)

Goes back to the sheet open under the given key, closing everything opened from it. Returns false - and changes nothing - when no sheet is open under that key.

Method
ModalStack.Pop
public static void Pop()

Closes the sheet in front, going back to the one it was opened from.

Method
ModalStack.PopTo
public static void PopTo(string key)

Closes everything opened from the sheet under the given key, leaving that sheet in front.

Method
ModalStack.Remove
public static void Remove(Modal modal)

Closes the sheet showing the given modal, wherever it is in the chain, leaving the rest of the chain as it was.

Method
ModalStack.Clear
public static void Clear()

Closes the whole chain.

Events

NameDescription
ChangedRaised whenever the chain changes - a sheet pushed, popped, replaced or dropped - so a host can keep the route (or anything else naming what is open) in step with it.
Event
ModalStack.Changed
public static event Action Changed

Raised whenever the chain changes - a sheet pushed, popped, replaced or dropped - so a host can keep the route (or anything else naming what is open) in step with it.

Fields

NameDescription
MaxDepthHow many sheets the stack keeps before it starts dropping the oldest one.
Field
ModalStack.MaxDepth
public const int MaxDepth = 4

How many sheets the stack keeps before it starts dropping the oldest one.

Samples

Basic Modal Example

This sample demonstrates creating a simple modal with a header, a footer, and centered content. It showcases how to enable light dismiss and display the modal with default settings.

Positioned and Async Modal

This sample shows how to display a modal at custom screen positions and use the asynchronous show method to perform actions after the modal is hidden.

See also

  • Dialog – For quick user decision making.
  • Panel – For side-surface interactions.
  • Float – For floating panels and tooltips.
© 2026 Curiosity. All rights reserved.