# Dialog
## Description
A modal pop-up that puts a short decision in front of the page and waits for an answer: a title, a message and an Ok/Cancel pair out of the box, focus that moves in, stays in and comes back, Escape and click-outside dismissal that can be refused, and an answer read from a two-way bound IsOpen or awaited from Show().
## Parameters
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| AbsolutePosition | `bool` | false | When true, the Dialog will be positioned absolute instead of fixed, so it covers its nearest positioned ancestor instead of the screen. |
| AutoFocus | `bool` | true | Moves the focus into the Dialog when it opens, onto the first focusable element it holds, falling back to the Dialog itself when it holds none. |
| AutoFocusButton | `BitDialogButton?` | null | Which of the Dialog's own buttons AutoFocus lands on, instead of the first focusable element the Dialog holds. One set on the Dialog takes precedence over AutoFocusSelector and over an element its content marks with data-autofocus or autofocus. One that comes from a BitParams ancestor is a default that comes after both, but still before the first focusable element. A button that is hidden or disabled is passed over for the next in that order. |
| AutoFocusSelector | `string?` | null | The CSS selector of the element inside the Dialog that AutoFocus lands on, instead of the first focusable element it holds. An AutoFocusButton set on the Dialog takes precedence over it, while one that comes from a BitParams ancestor does not. A selector that matches nothing visible falls back to an element the content marks with data-autofocus or autofocus, then to the AutoFocusButton of a BitParams ancestor, then to the first focusable element. |
| AutoToggleScroll | `bool` | false | Enables the auto scrollbar toggle behavior of the Dialog, which stops the scroller from scrolling for as long as the Dialog is open. The scroller is the one ScrollerElement or ScrollerSelector names, the one a surrounding BitAppShell cascades when neither does, and the page when there is no shell either. |
| Body | `RenderFragment?` | null | Alias for child content. |
| CancelText | `string?` | Cancel | The text of the cancel button. |
| ChildContent | `RenderFragment?` | null | The content of the Dialog, it can be any custom tag or text. |
| Classes | `BitDialogClassStyles?` | null | Custom CSS classes for different parts of the BitDialog component. |
| CloseButtonTitle | `string?` | null | The title (and aria-label) of the close button, for accessibility and localization. Defaults to "Close" when not set. |
| CloseIcon | `BitIconInfo?` | null | Gets or sets the icon to display for the close button using custom CSS classes for external icon libraries. Takes precedence over CloseIconName when both are set. |
| CloseIconName | `string?` | null | Gets or sets the name of the icon to display for the close button from the built-in Fluent UI icons. |
| CloseOnEscape | `bool` | true | Dismisses the Dialog when the Escape key is pressed while the focus is inside it. A blocking Dialog ignores the Escape key whatever this is set to, and an Escape a field inside answers first (closing its own open list, clearing itself, cancelling an IME composition) is left to it. |
| CloseOnOverlayClick | `bool` | true | Dismisses the Dialog when its overlay is clicked. Turn it off to refuse a stray click outside while the Escape key still closes the Dialog; a blocking Dialog refuses the click whatever this is set to. |
| Color | `BitColor?` | null | The general color of the Dialog, which its Ok and Cancel buttons, the Ok spinner and the focus ring of both are painted in. It wins over the --bit-Dialog-ok-button-* and --bit-Dialog-cancel-button-* CSS variables wherever it paints; left unset, the buttons follow those variables and then Primary. |
| DefaultIsOpen | `bool?` | null | The initial opening state of the Dialog in the uncontrolled mode, which is when the IsOpen parameter is not set. It is read once, at initialization, so closing such a Dialog is not undone by the next render. |
| DragElementSelector | `string?` | null | The CSS selector of the element the Dialog is dragged by. By default it is the header when the Dialog has one, and the whole container when it has none. |
| FooterTemplate | `RenderFragment?` | null | Used to customize how the footer inside the Dialog is rendered. |
| FullHeight | `bool` | false | Makes the Dialog height 100% of the area it is positioned in. |
| FullSize | `bool` | false | Makes the Dialog width and height 100% of the area it is positioned in. |
| FullWidth | `bool` | false | Makes the Dialog width 100% of the area it is positioned in. |
| HeaderTemplate | `RenderFragment?` | null | Used to customize the header of the Dialog, replacing the Title and Subtitle while keeping the close button beside it. |
| Height | `string?` | null | The CSS height of the Dialog surface. A Dialog is as tall as its content by default, and FullHeight and FullSize take precedence over this. |
| IsAlert | `bool?` | null | Determines the ARIA role of the Dialog (alertdialog/dialog). If this is set, it will override the ARIA role determined by Blocking and Modeless. |
| Blocking | `bool` | false | Prevents the Dialog from being dismissed by a click on the overlay or by the Escape key, leaving its buttons as the only way out. |
| IsCancelButtonEnabled | `bool` | true | Whether the Cancel button of the Dialog can be pressed. Unlike Disabled, which turns the whole Dialog off, this leaves every other way out of the Dialog working. |
| IsDraggable | `bool` | false | Whether the Dialog can be dragged around. |
| Modeless | `bool` | false | Whether the Dialog should be modeless (e.g. not dismiss when focusing/clicking outside of the Dialog). If true, Blocking is ignored, there will be no overlay, and the focus is not trapped - though the Dialog still takes it when it opens unless AutoFocus is turned off. |
| IsOkButtonEnabled | `bool` | true | Whether the Ok button of the Dialog can be pressed. This is what holds the answer shut until the content of the Dialog provides it - a consent to tick, a name to type - without turning the rest of the Dialog off the way Disabled would. |
| IsOpen | `bool` | false | Whether the Dialog is displayed. |
| IsOpenChanged | `EventCallback<bool>` | null | A callback function for when the Dialog is opened or closed. |
| KeepMounted | `bool` | false | Keeps the Dialog in the DOM while it is closed, hidden, instead of removing it - so its content, and whatever state it holds, survives until the next showing. Nothing is rendered until the first time it opens, so a Dialog that is never opened still costs nothing. |
| MaxHeight | `string?` | null | The CSS maximum height of the Dialog surface. Defaults to 100% of the area the Dialog is positioned in, and setting it replaces that default rather than adding to it. |
| MaxWidth | `string?` | null | The CSS maximum width of the Dialog surface. Defaults to the narrower of 100% of the area the Dialog is positioned in and --bit-Dialog-max-width (the --bit-siz-dialog-max-width theme token unless set), and setting it replaces that default rather than adding to it - min(100%, 32rem) is the whole of a responsive Dialog. |
| Message | `string?` | null | The message to display in the dialog. It also describes the Dialog to a screen reader unless a Subtitle or a SubtitleAriaId takes that job instead. |
| MinHeight | `string?` | null | The CSS minimum height of the Dialog surface. |
| MinWidth | `string?` | null | The CSS minimum width of the Dialog surface, the floor under a Dialog whose message is a handful of words. |
| NoDismissPreventedAnimation | `bool` | false | Turns off the shake the Dialog plays when a dismissal is refused. OnDismissPrevented is raised either way. |
| OkText | `string?` | Ok | The text of the ok button. |
| OnCancel | `EventCallback<MouseEventArgs>` | null | A callback function for when the Cancel button is clicked. |
| OnClose | `EventCallback<MouseEventArgs>` | null | A callback function for when the Close button is clicked. |
| OnDismiss | `EventCallback<MouseEventArgs>` | null | A callback function for when the the dialog is dismissed (closed). It is invoked for every closing the Dialog carries out itself, including a Close or Toggle call, and DismissReason names the gesture that ended the showing by the time it runs. |
| OnDismissing | `EventCallback<BitDialogDismissArgs>` | null | A callback function invoked before the Dialog closes, letting the closing be refused. Set Cancel on the arguments to leave the Dialog where it is, and read Reason to tell the gestures apart. It is awaited, so it can run asynchronous work of its own. |
| OnDismissPrevented | `EventCallback<BitDialogDismissReason>` | null | A callback function for when a dismissal was refused: the Escape key or a click on the overlay the Dialog does not take (CloseOnEscape, CloseOnOverlayClick, Blocking), or a closing OnDismissing turned down. The Dialog shakes on its own; this is for saying why. |
| OnOverlayClick | `EventCallback<MouseEventArgs>` | null | A callback function for when the overlay of the Dialog is clicked, whether or not the click goes on to dismiss the Dialog. |
| OnOk | `EventCallback<MouseEventArgs>` | null | A callback function for when the Ok button is clicked. The Dialog waits for it before closing and shows a spinner in place of the Ok text while it waits. |
| OnOpen | `EventCallback` | null | A callback function for when the Dialog is opened. |
| Position | `BitPosition` | BitPosition.Center | Position of the Dialog on the screen. |
| RestoreFocus | `bool` | true | Hands the focus back to whatever held it when the Dialog opened, once the Dialog closes. |
| ScrollerElement | `ElementReference?` | null | Set the element reference for which the Dialog disables its scroll if applicable. Takes precedence over ScrollerSelector when both are set. |
| ScrollerSelector | `string?` | null | The CSS selector of the element whose scrolling the Dialog holds while it is open, for the layouts whose scroller is not the page itself. A Dialog inside a BitAppShell holds the shell's scroller without being told to; the page (body) is what is held when there is no shell and this is not set. |
| ShowCancelButton | `bool` | true | Shows or hides the cancel button of the Dialog. |
| ShowCloseButton | `bool` | true | Shows or hides the close button of the Dialog. |
| ShowOkButton | `bool` | true | Shows or hides the ok button of the Dialog. |
| Styles | `BitDialogClassStyles?` | null | Custom CSS styles for different parts of the BitDialog component. |
| Subtitle | `string?` | null | The secondary line of the header, under the title. |
| SubtitleAriaId | `string?` | null | ARIA id for the subtitle of the Dialog, if any. When it is not set, the Dialog describes itself with its own Subtitle, or with its Message when there is no subtitle. |
| Title | `string?` | null | The title text to display at the top of the dialog. |
| TitleAriaId | `string?` | null | ARIA id for the title of the Dialog, if any. When it is not set, the Dialog names itself with its own Title, and falls back to AriaLabel when there is none. |
| TrapFocus | `bool?` | null | Keeps Tab and Shift+Tab cycling inside the Dialog while it is open. Defaults to true for a normal Dialog and false for a modeless one. |
| Width | `string?` | null | The CSS width of the Dialog surface. A Dialog is as wide as its content by default, and FullWidth and FullSize take precedence over this. |
| AriaLabel | `string?` | null | Gets or sets the accessible label for the component, used by assistive technologies. |
| Class | `string?` | null | Gets or sets the CSS class name(s) to apply to the rendered element. |
| Dir | `BitDir?` | null | Gets or sets the text directionality for the component's content. |
| Disabled | `bool` | false | Gets or sets a value indicating whether the component is disabled and cannot respond to user interaction. |
| ForceAnimation | `bool` | false | Gets or sets a value indicating whether the component's animations play at their full duration even when reduced motion is requested. |
| HtmlAttributes | `Dictionary<string, object>` | new Dictionary<string, object>() | Captures additional HTML attributes to be applied to the rendered element, in addition to the component's parameters. An attribute written on the component wins over an entry of the same name. |
| Id | `string?` | null | Gets or sets the unique identifier for the component's root element. |
| Style | `string?` | null | Gets or sets the CSS style string to apply to the rendered element. |
| TabIndex | `string?` | null | Gets or sets the tab order index for the component when navigating with the keyboard. |
| Visibility | `BitVisibility` | BitVisibility.Visible | Gets or sets the visibility state (visible, hidden, or collapsed) of the component. |
## Public Members
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| Result | `BitDialogResult?` | null | The result of the last showing of the Dialog: Ok or Cancel when one of those buttons ended it, and null when it was dismissed without an answer or has not been shown yet. |
| DismissReason | `BitDialogDismissReason?` | null | What ended the last showing of the Dialog - the gesture that closed it - and null while it is open or before it has been shown at all. It is set before OnDismiss and IsOpenChanged run. |
| Show | `Task<BitDialogResult?>` | | Opens the Dialog and waits for it to close, reporting how it closed. |
| Open | `Task` | | Opens the Dialog. |
| Close | `Task` | | Closes the Dialog the same way its own gestures do: OnDismissing gets its say and can refuse it, DismissReason is named Programmatic, and OnDismiss is invoked once it is done. |
| Toggle | `Task` | | Opens the Dialog when it is closed and closes it when it is open. |
| UniqueId | `Guid` | Guid.NewGuid() | Gets the readonly unique identifier for the component's root element, assigned when the component instance is constructed. |
| RootElement | `ElementReference` | | Gets the reference to the root HTML element associated with this component. |
## Enums
### BitColor Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Primary | 0 | Primary general color. |
| Secondary | 1 | Secondary general color. |
| Tertiary | 2 | Tertiary general color. |
| Info | 3 | Info general color. |
| Success | 4 | Success general color. |
| Warning | 5 | Warning general color. |
| SevereWarning | 6 | SevereWarning general color. |
| Error | 7 | Error general color. |
| PrimaryBackground | 8 | Primary background color. |
| SecondaryBackground | 9 | Secondary background color. |
| TertiaryBackground | 10 | Tertiary background color. |
| PrimaryForeground | 11 | Primary foreground color. |
| SecondaryForeground | 12 | Secondary foreground color. |
| TertiaryForeground | 13 | Tertiary foreground color. |
| PrimaryBorder | 14 | Primary border color. |
| SecondaryBorder | 15 | Secondary border color. |
| TertiaryBorder | 16 | Tertiary border color. |
### BitPosition Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| TopLeft | 0 | The top left corner, in both reading directions. |
| TopCenter | 1 | The top edge, centered horizontally. |
| TopRight | 2 | The top right corner, in both reading directions. |
| TopStart | 3 | The top edge, on the side the reading direction starts from. |
| TopEnd | 4 | The top edge, on the side the reading direction ends at. |
| CenterLeft | 5 | The left edge, centered vertically, in both reading directions. |
| Center | 6 | Centered both ways. |
| CenterRight | 7 | The right edge, centered vertically, in both reading directions. |
| CenterStart | 8 | Centered vertically, on the side the reading direction starts from. |
| CenterEnd | 9 | Centered vertically, on the side the reading direction ends at. |
| BottomLeft | 10 | The bottom left corner, in both reading directions. |
| BottomCenter | 11 | The bottom edge, centered horizontally. |
| BottomRight | 12 | The bottom right corner, in both reading directions. |
| BottomStart | 13 | The bottom edge, on the side the reading direction starts from. |
| BottomEnd | 14 | The bottom edge, on the side the reading direction ends at. |
### BitDialogResult Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Ok | 0 | The Ok button ended the showing. |
| Cancel | 1 | The Cancel button ended the showing. |
### BitDialogDismissReason Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| OkButton | 0 | The Ok button ended the showing. |
| CancelButton | 1 | The Cancel button ended the showing. |
| CloseButton | 2 | The close button in the header ended the showing. |
| OverlayClick | 3 | A click on the overlay ended the showing. |
| Escape | 4 | The Escape key ended the showing. |
| Programmatic | 5 | The page closed the Dialog itself, by setting IsOpen or by calling Close or Toggle. |
### BitDialogButton Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Ok | 0 | The Ok button, which answers the Dialog with BitDialogResult.Ok. |
| Cancel | 1 | The Cancel button, which answers the Dialog with BitDialogResult.Cancel. |
| Close | 2 | The close button in the header, which dismisses the Dialog without an answer. |
### BitVisibility Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Visible | 0 | The content of the component is visible. |
| Hidden | 1 | The content of the component is hidden, but the space it takes on the page remains (visibility:hidden). |
| Collapsed | 2 | The component is hidden (display:none). |
### BitDir Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Ltr | 0 | Ltr (left to right) is to be used for languages that are written from the left to the right (like English). |
| Rtl | 1 | Rtl (right to left) is to be used for languages that are written from the right to the left (like Arabic). |
| Auto | 2 | Auto lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then applies that directionality to the whole element. |
## Sub Classes
### BitDialogClassStyles Properties
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| Root | `string?` | null | Custom CSS classes/styles for the root element of the BitDialog. |
| Document | `string?` | null | Custom CSS classes/styles for the document element of the BitDialog, the layer that holds the overlay and the container and decides where on the screen the Dialog sits. |
| Overlay | `string?` | null | Custom CSS classes/styles for the overlay of the BitDialog. |
| Container | `string?` | null | Custom CSS classes/styles for the container of the BitDialog. |
| Header | `string?` | null | Custom CSS classes/styles for the header of the BitDialog. |
| Body | `string?` | null | Custom CSS classes/styles for the body of the BitDialog. |
| Title | `string?` | null | Custom CSS classes/styles for the title of the BitDialog. |
| Subtitle | `string?` | null | Custom CSS classes/styles for the subtitle of the BitDialog. |
| CloseButton | `string?` | null | Custom CSS classes/styles for the close button of the BitDialog. |
| CloseIcon | `string?` | null | Custom CSS classes/styles for the icon of the close button of the BitDialog. |
| Message | `string?` | null | Custom CSS classes/styles for the message of the BitDialog. |
| ButtonsContainer | `string?` | null | Custom CSS classes/styles for the buttons container of the BitDialog. |
| Spinner | `string?` | null | Custom CSS classes/styles for the spinner of the ok button of the BitDialog. |
| OkButton | `string?` | null | Custom CSS classes/styles for the ok button of the BitDialog. |
| CancelButton | `string?` | null | Custom CSS classes/styles for the cancel button of the BitDialog. |
| Footer | `string?` | null | Custom CSS classes/styles for the footer of the BitDialog, the element that wraps the FooterTemplate. |
### BitDialogDismissArgs Properties
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| Reason | `BitDialogDismissReason` | | What is about to close the Dialog: one of its three buttons, a click on the overlay, the Escape key, or a call to one of its Close and Toggle methods. |
| Cancel | `bool` | false | Set to true to refuse the closing and leave the Dialog where it is. A refused closing shakes the surface and raises OnDismissPrevented with the same reason. |
### BitIconInfo Properties
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| Name | `string?` | null | Gets or sets the name of the icon. |
| BaseClass | `string?` | null | Gets or sets the base CSS class for the icon. For built-in Fluent UI icons, this defaults to "bit-icon". For external icon libraries like FontAwesome, you might set this to "fa" or leave empty. |
| Prefix | `string?` | null | Gets or sets the CSS class prefix used before the icon name. For built-in Fluent UI icons, this defaults to "bit-icon--". For external icon libraries, you might set this to "fa-" or leave empty. |
## CSS Variables
Public CSS custom properties read off the component's root. Set one on `:root` to restyle every instance, on any ancestor to restyle the ones inside it, or on the `Style` of one instance to restyle it and every instance nested inside it, which inherits the value too - a parameter changes one alone, as does the real CSS property on its `Style` / `Styles` when that property does not inherit (`opacity`); an inherited one (`color`, `font-family`) reaches the nested instances that do not set it themselves.
| Name | Default Value | Description |
| :--- | :------------ | :---------- |
| `--bit-Dialog-z-index` | --bit-zin-modal | Stacking order of the full-screen Dialog. An AbsolutePosition Dialog stacks inside its own area at auto and does not read it; give one a z-index through its own Class or Style. |
| `--bit-Dialog-margin` | 0 | Space kept between the surface and the edges of its area, for every Position and every size - a gutter on phones, where the surface otherwise reaches the edges. |
| `--bit-Dialog-overlay-background` | --bit-clr-bg-overlay | Color of the overlay behind the surface. |
| `--bit-Dialog-overlay-backdrop-filter` | none | Filter applied to the page behind the overlay, e.g. blur(4px). |
| `--bit-Dialog-background` | --bit-clr-bg-pri | Background of the surface, its header, its buttons band and its footer. |
| `--bit-Dialog-color` | --bit-clr-fg-pri | Text color of the surface, which the title, the close button and custom content inherit. |
| `--bit-Dialog-border-width` | 0 | Thickness of the border around the surface. |
| `--bit-Dialog-border-color` | transparent | Color of the border around the surface. |
| `--bit-Dialog-radius` | --bit-shp-radius-dialog | Corner radius of the surface and of the bands inside it. |
| `--bit-Dialog-shadow` | --bit-shd-dialog | Elevation of the surface. |
| `--bit-Dialog-padding` | --bit-spa-dialog | Inset of the header, the message and the buttons. |
| `--bit-Dialog-max-width` | --bit-siz-dialog-max-width | Width the surface stops growing at on its own. Ignored by a Dialog given a Width, MaxWidth, FullWidth or FullSize. |
| `--bit-Dialog-text-align` | --bit-layout-dialog-text-align | Alignment of the title, the subtitle and the message (start, or center under Cupertino). |
| `--bit-Dialog-title-color` | inherit | Color of the title. |
| `--bit-Dialog-title-font-size` | --bit-tpg-dialog-title-font-size | Font size of the title. |
| `--bit-Dialog-title-font-weight` | --bit-tpg-dialog-title-font-weight | Font weight of the title. |
| `--bit-Dialog-subtitle-color` | --bit-clr-fg-sec | Color of the subtitle. |
| `--bit-Dialog-message-color` | --bit-clr-fg-sec | Color of the message. |
| `--bit-Dialog-ok-button-background` | --bit-clr-pri | Background of the Ok button. The Color parameter wins over it. |
| `--bit-Dialog-ok-button-color` | --bit-clr-pri-text | Text color of the Ok button, and the color of the spinner it shows while OnOk runs (--bit-clr-pri-dark when unset). The Color parameter wins over it. |
| `--bit-Dialog-ok-button-border-color` | the background | Border color of the Ok button, at rest, on hover and while pressed; unset, the border takes the background of each state. The Color parameter wins over it. |
| `--bit-Dialog-ok-button-hover-background` | --bit-clr-pri-hover | Background of the Ok button on hover. Falls back to --bit-Dialog-ok-button-background when that is set, so a restyled button is not handed back the primary color under the pointer. The Color parameter wins over it. |
| `--bit-Dialog-ok-button-hover-color` | the text color | Text color of the Ok button on hover. The Color parameter wins over it. |
| `--bit-Dialog-ok-button-active-background` | --bit-clr-pri-active | Background of the Ok button while pressed. Falls back to the hover background, then the background, when either is set. The Color parameter wins over it. |
| `--bit-Dialog-ok-button-active-color` | the hover text color | Text color of the Ok button while pressed. The Color parameter wins over it. |
| `--bit-Dialog-ok-button-radius` | --bit-shp-radius-button | Corner radius of the Ok button. |
| `--bit-Dialog-cancel-button-background` | transparent | Background of the Cancel button at rest, e.g. a neutral fill in place of the outline. Still applies under an explicit Color, which paints only the text and border of the button at rest. |
| `--bit-Dialog-cancel-button-color` | --bit-clr-pri | Text color of the Cancel button. The Color parameter wins over it. |
| `--bit-Dialog-cancel-button-border-color` | the text color | Border color of the Cancel button, at rest, on hover and while pressed; unset, the border takes the text color at rest and the background of the state on hover and while pressed. The Color parameter wins over it. |
| `--bit-Dialog-cancel-button-hover-background` | --bit-clr-pri-hover | Background of the Cancel button on hover. It does not fall back to --bit-Dialog-cancel-button-background: the outline fills under the pointer, so set it along with --bit-Dialog-cancel-button-hover-color. The Color parameter wins over it. |
| `--bit-Dialog-cancel-button-hover-color` | --bit-clr-pri-text | Text color of the Cancel button on hover, on the hover background. It does not fall back to --bit-Dialog-cancel-button-color, which is meant for the outline at rest. The Color parameter wins over it. |
| `--bit-Dialog-cancel-button-active-background` | --bit-clr-pri-active | Background of the Cancel button while pressed. Falls back to the hover background when that is set. The Color parameter wins over it. |
| `--bit-Dialog-cancel-button-active-color` | --bit-clr-pri-text | Text color of the Cancel button while pressed. Falls back to the hover text color when that is set. The Color parameter wins over it. |
| `--bit-Dialog-cancel-button-radius` | --bit-shp-radius-button | Corner radius of the Cancel button. |
## Examples
\n**Basic**:
```razor
Open Dialog
```
```csharp
private bool isOpenBasic;
```
\n**Buttons**:
```razor
Custom labels
Single action
Gated Ok
```
```csharp
private bool isOpenLabels;
private bool isOpenAcknowledge;
private bool isOpenGated;
private bool agreed;
```
\n**Header & footer**:
```razor
Subtitle
HeaderTemplate
FooterTemplate
Storage almost full
```
```csharp
private bool isOpenSubtitle;
private bool isOpenHeaderTemplate;
private bool isOpenFooterTemplate;
```
\n**Custom content**:
```razor
Open Dialog
```
```csharp
private bool isOpenCustom;
private string? optionValue;
```
\n**Result**:
```razor
Open Dialog
Show and await
```
```csharp
private bool isOpenResult;
private BitDialog resultDialogRef = default!;
private BitDialog awaitDialogRef = default!;
private string awaitedResult = "-";
private async Task ShowAndAwait()
{
var result = await awaitDialogRef.Show();
awaitedResult = result?.ToString() ?? "(dismissed)";
}
```
\n**Events**:
```razor
Open Dialog
```
```csharp
private bool isOpenEvents;
private string lastEvent = "-";
private async Task HandleSlowOk()
{
lastEvent = "OnOk (working...)";
await Task.Delay(1000);
lastEvent = "OnOk";
}
```
\n**Dismiss behavior**:
```razor
Blocking
CloseOnOverlayClick="false"
CloseOnEscape="false"
Modeless
```
```csharp
private bool isOpenBlocking;
private bool isOpenNoOverlayClick;
private bool isOpenNoEscape;
private bool isOpenModeless;
private string? preventedHint;
```
\n**Guarded close**:
```razor
Open Dialog
```
```csharp
private bool hasUnsavedChanges = true;
private bool isOpenGuarded;
private string? guardedHint;
private string refusedGesture = "-";
private void HandleDismissing(BitDialogDismissArgs args)
{
// Save is the way out that is always let through, so the Dialog is never a trap.
args.Cancel = hasUnsavedChanges && args.Reason is not BitDialogDismissReason.OkButton;
}
```
\n**Focus management**:
```razor
Default
AutoFocus & TrapFocus off
AutoFocusButton
AutoFocusSelector
What can a guest see?
```
```csharp
private bool isOpenFocus;
private bool isOpenNoFocus;
private bool isOpenFocusCancel;
private bool isOpenFocusSelector;
```
\n**Position**:
```razor
```
```csharp
private bool isOpenPosition;
private BitPosition position;
private readonly BitPosition[] dialogPositions =
[
BitPosition.TopLeft, BitPosition.TopCenter, BitPosition.TopRight,
BitPosition.CenterLeft, BitPosition.Center, BitPosition.CenterRight,
BitPosition.BottomLeft, BitPosition.BottomCenter, BitPosition.BottomRight,
];
private void OpenDialogInPosition(BitPosition value)
{
position = value;
isOpenPosition = true;
}
```
\n**Absolute position & scroll lock**:
```razor
AutoToggleScroll
AbsolutePosition
Every story starts with a blank canvas, a quiet space waiting to be filled with ideas, emotions, and dreams.
These placeholder words symbolize the beginning - a moment of possibility where creativity has yet to take shape.
Imagine this text as the scaffolding of something remarkable, a foundation upon which connections and
inspirations will be built. Soon, these lines will transform into narratives that provoke thought,
spark emotion, and resonate with those who encounter them.
Once upon a time, stories wove connections between people, a symphony of voices crafting shared dreams. Each word carried meaning, each pause brought understanding. Placeholder text reminds us of that moment when possibilities are limitless, waiting for content to emerge. The spaces here are open for growth, for ideas that change minds and spark emotions. This is where the journey begins.
In the beginning, there is silence, a blank canvas yearning to be filled, a quiet space where creativity waits to awaken. These words are temporary, standing in place of ideas yet to come, a glimpse into the infinite possibilities that lie ahead. Think of this text as a bridge, connecting the empty spaces of now with the vibrant narratives of tomorrow.
```
```csharp
private bool isOpenScrollLock;
private bool isOpenAbsolute;
```
\n**Draggable**:
```razor
Header handle
DragElementSelector
```
```csharp
private bool isDraggable = true;
private bool isOpenDraggable;
private bool isOpenDragHandle;
```
\n**Nested dialogs**:
```razor
Open Dialog
What changed?
```
```csharp
private bool isOpenOuter;
private bool isOpenInner;
private readonly List> audienceItems =
[
new() { Text = "Everyone", Value = "all" },
new() { Text = "Editors", Value = "editors" },
new() { Text = "Reviewers", Value = "reviewers" },
new() { Text = "Nobody", Value = "none" }
];
```
\n**Keep mounted**:
```razor
KeepMounted
Default
```
```csharp
private bool isOpenKeptMounted;
private bool isOpenUnmounted;
```
\n**Programmatic control**:
```razor
Open
Toggle
```
```csharp
private BitDialog programmaticDialogRef = default!;
```
\n**Cascading parameters**:
```razor
Delete file
Delete folder
```
```csharp
private bool isOpenCascadedFile;
private bool isOpenCascadedFolder;
private readonly BitDialogParams[] dialogParams =
[
new()
{
OkText = "Delete",
CancelText = "Keep",
ShowCloseButton = false,
CloseOnOverlayClick = false,
AutoFocusButton = BitDialogButton.Cancel,
Position = BitPosition.TopCenter,
}
];
```
\n**Color**:
```razor
```
```csharp
private bool isOpenColor;
private BitColor dialogColor = BitColor.Primary;
private readonly BitColor[] dialogColors = Enum.GetValues();
private void OpenDialogInColor(BitColor color)
{
dialogColor = color;
isOpenColor = true;
}
private async Task HandleColorOk()
{
await Task.Delay(1000);
}
```
\n**External Icons**:
```razor
CloseIconName
FontAwesome
Bootstrap
Css
```
```csharp
private bool isOpenIconName;
private bool isOpenIconFa;
private bool isOpenIconBi;
private bool isOpenIconCss;
```
\n**Size**:
```razor
Width
MinWidth & MaxWidth
Height
FullWidth
FullSize
```
```csharp
private bool isOpenWidth;
private bool isOpenResponsive;
private bool isOpenHeight;
private bool isOpenFullWidth;
private bool isOpenFullSize;
```
\n**Style & Class**:
```razor
Styles
Classes
CSS variables
```
```csharp
private bool isOpenStyles;
private bool isOpenClasses;
private bool isOpenCssVariables;
```
\n**RTL**:
```razor
باز کردن پنجره پیام
TopStart
TopLeft
```
```csharp
private bool isOpenRtl;
private bool isOpenRtlStart;
private bool isOpenRtlLeft;
```
Selected option: @(optionValue ?? "-")
All emails together
Your inbox has changed: it no longer includes favorites, it is a single destination for all your emails.
Result: @(resultDialogRef?.Result?.ToString() ?? "-"), reason: @(resultDialogRef?.DismissReason?.ToString() ?? "-")
Awaited result: @awaitedResult
Last event: @lastEvent
Last refused: @refusedGesture
@foreach (var pos in dialogPositions)
{
@pos
}
Once upon a time, stories wove connections between people, a symphony of voices crafting shared dreams. Each word carried meaning, each pause brought understanding. Placeholder text reminds us of that moment when possibilities are limitless, waiting for content to emerge. The spaces here are open for growth, for ideas that change minds and spark emotions. This is where the journey begins.
In the beginning, there is silence, a blank canvas yearning to be filled, a quiet space where creativity waits to awaken. These words are temporary, standing in place of ideas yet to come, a glimpse into the infinite possibilities that lie ahead. Think of this text as a bridge, connecting the empty spaces of now with the vibrant narratives of tomorrow.
Drag me by this bar
The bar above is the handle; the button inside it still closes the Dialog.
@foreach (var color in dialogColors)
{
@color
}
Every story starts with a blank canvas, a quiet space waiting to be filled with ideas, emotions, and dreams.
These placeholder words symbolize the beginning - a moment of possibility where creativity has yet to take shape.
Imagine this text as the scaffolding of something remarkable, a foundation upon which connections and
inspirations will be built. Soon, these lines will transform into narratives that provoke thought,
spark emotion, and resonate with those who encounter them.
Once upon a time, stories wove connections between people, a symphony of voices crafting shared dreams. Each word carried meaning, each pause brought understanding. Placeholder text reminds us of that moment when possibilities are limitless, waiting for content to emerge. The spaces here are open for growth, for ideas that change minds and spark emotions. This is where the journey begins.
In the beginning, there is silence, a blank canvas yearning to be filled, a quiet space where creativity waits to awaken. These words are temporary, standing in place of ideas yet to come, a glimpse into the infinite possibilities that lie ahead. Think of this text as a bridge, connecting the empty spaces of now with the vibrant narratives of tomorrow.
Once upon a time, stories wove connections between people, a symphony of voices crafting shared dreams. Each word carried meaning, each pause brought understanding. Placeholder text reminds us of that moment when possibilities are limitless, waiting for content to emerge. The spaces here are open for growth, for ideas that change minds and spark emotions. This is where the journey begins.
In the beginning, there is silence, a blank canvas yearning to be filled, a quiet space where creativity waits to awaken. These words are temporary, standing in place of ideas yet to come, a glimpse into the infinite possibilities that lie ahead. Think of this text as a bridge, connecting the empty spaces of now with the vibrant narratives of tomorrow.