A centered dialog overlay widget. More...
Public Member Functions | |
| Region | ComputeBodyRegion (Region outer) |
| Returns the region allocated to Body within the centered dialog box. | |
| Modal () | |
| Object-initializer constructor; all properties default. | |
| Modal (string title="", IWidget? body=null, int dialogWidth=60, int dialogHeight=16, bool showBackdrop=false, Style? style=null) | |
| Positional constructor for inline usage. | |
| void | Render (IRenderContext ctx) |
| Optionally fills the region with a backdrop, then renders a centered bordered dialog box containing Body. | |
Properties | |
| Style | BackdropStyle [get] |
| Style used for the backdrop fill when ShowBackdrop is true. | |
| IWidget? | Body [get] |
| Content widget rendered inside the dialog box. | |
| int | DialogHeight = 16 [get] |
| Height of the dialog box in rows. | |
| int | DialogWidth = 60 [get] |
| Width of the dialog box in columns. | |
| SizeConstraint | Height = SizeConstraint.Flex(1) [get] |
| Height constraint of the outer region (not the dialog box). | |
| bool | ShowBackdrop = false [get] |
| When true, fills the entire region with BackdropStyle spaces before rendering the dialog box, creating a dark-overlay effect. | |
| Style | Style = Style.Default.Border(Borders.Rounded) [get] |
| Visual style for the dialog border and title. Inherits theme border style when unset. | |
| string | Title = "" [get] |
| Title text rendered in the dialog's top border edge. | |
| SizeConstraint | Width = SizeConstraint.Flex(1) [get] |
| Width constraint of the outer region (not the dialog box). | |
A centered dialog overlay widget.
Renders a bordered box on top of whatever is already in the cell buffer (paint-over, no viewport capture).
Compose with ZStack to show a modal on top of existing content:
Focus — FocusManager traverses into Body automatically (Modal implements ISingleBodyWidget). The model is responsible for routing keyboard input to the modal when it is open.
Backdrop — When ShowBackdrop is true, the entire region is filled with BackdropStyle spaces before drawing the dialog box. This replaces background content with a dark overlay. When false (default), content behind the modal remains visible.
| ConsoleForge.Widgets.Modal.Modal | ( | string | title = "", |
| IWidget? | body = null, | ||
| int | dialogWidth = 60, | ||
| int | dialogHeight = 16, | ||
| bool | showBackdrop = false, | ||
| Style? | style = null ) |
Positional constructor for inline usage.
| title | Dialog title in the top border. |
| body | Content widget inside the dialog. |
| dialogWidth | Dialog box width (columns). Default 60. |
| dialogHeight | Dialog box height (rows). Default 16. |
| showBackdrop | Fill background with BackdropStyle before drawing. |
| style | Optional border/title style override. |
|
get |
Style used for the backdrop fill when ShowBackdrop is true.
Defaults to a dark background with faint text.
|
get |
Height of the dialog box in rows.
Clamped to the available terminal height. Default 16.
|
get |
Width of the dialog box in columns.
Clamped to the available terminal width. Default 60.
|
get |
Height constraint of the outer region (not the dialog box).
Defaults to SizeConstraint.Flex so the widget fills the terminal.
Implements ConsoleForge.Layout.IWidget.
|
get |
When true, fills the entire region with BackdropStyle spaces before rendering the dialog box, creating a dark-overlay effect.
Default false (background content remains visible).
|
get |
Width constraint of the outer region (not the dialog box).
Defaults to SizeConstraint.Flex so the widget fills the terminal.
Implements ConsoleForge.Layout.IWidget.