Import
import {
Dialog,
DialogTrigger,
DialogContent,
DialogHeader,
DialogFooter,
DialogTitle,
DialogDescription,
DialogClose,
} from '@strongtie/design-system/dialog';
Usage
<Dialog>
<DialogTrigger asChild>
<Button variant="outline">Open Dialog</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Dialog Title</DialogTitle>
<DialogDescription>
Make changes to your profile here. Click save when you're done.
</DialogDescription>
</DialogHeader>
<div className="py-4">
<p>Dialog content goes here.</p>
</div>
<DialogFooter>
<Button type="submit">Save changes</Button>
</DialogFooter>
</DialogContent>
</Dialog>
<Dialog> Props
If true, the dialog will be open by default.
If true, the dialog will be open.
Callback function that is called when the open state changes.
When set to true, interaction with outside elements will be disabled and only
dialog content will be visible to screen readers.
<DialogTrigger> Props
If true, the trigger will render as a child component.
<DialogPortal> Props
Used to force mounting when more control is needed.
container
HTMLElement
default:"document.body"
The container element to render the dialog into.
<DialogOverlay> Props
If true, the overlay will render as a child component.
Used to force mounting when more control is needed.
<DialogContent> Props
If true, the content will render as a child component.
If true, the content will always be mounted in the DOM.
Event handler called when focus moves into the component after opening. It can
be prevented by calling event.preventDefault.
Event handler called when focus moves to the trigger after closing. It can be
prevented by calling event.preventDefault.
Event handler called when the escape key is down. It can be prevented by
calling event.preventDefault.
Event handler called when a pointer event occurs outside the bounds of the
component. It can be prevented by calling event.preventDefault.
Event handler called when an interaction (pointer or focus event) happens
outside the bounds of the component. It can be prevented by calling
event.preventDefault.
<DialogClose> Props
If true, the close button will render as a child component.
<DialogTitle> Props
If true, the title will render as a child component.
<DialogDescription> Props
If true, the description will render as a child component.
Styling Classes
The following CSS classes are applied by the Dialog components:
dialog-overlay – Modal backdrop overlay
dialog-content – Main dialog container
dialog-close – Close button element
dialog-header – Dialog header section
dialog-footer – Dialog footer section
dialog-title – Dialog title element
dialog-description – Dialog description element
For more examples, visit the Storybook.@inject DialogService DialogService
await DialogService.OpenAsync(Title, ds => ChildContent, new DialogOptions
{
Width = Width,
Left = Left,
Top = Top,
Bottom = Bottom,
Height = Height,
ShowTitle = ShowTitle,
ShowClose = ShowClose,
Resizable = Resizable,
Draggable = Draggable,
Description = Description,
Style = Style,
AutoFocusFirstElement = AutoFocusFirstElement,
CloseDialogOnOverlayClick = CloseDialogOnOverlayClick,
CloseDialogOnEsc = CloseDialogOnEsc,
CssClass = CssClass,
WrapperCssClass = WrapperCssClass,
CloseTabIndex = CloseTabIndex,
ContentCssClass = ContentCssClass,
Resize = Resize,
Drag = Drag
});
}
Parameters
Gets or sets the child content.
Gets or sets the title of the dialog.
Gets or sets a value indicating whether to show the title.
Gets or sets the description of the dialog.
Gets or sets a value indicating whether to show the close button.
Gets or sets the width of the dialog.
Gets or sets the height of the dialog.
Gets or sets the left position of the dialog.
Gets or sets the top position of the dialog.
Gets or sets the bottom position of the dialog.
Gets or sets a value indicating whether the dialog is resizable.
Gets or sets a value indicating whether the dialog is draggable.
Gets or sets the style of the dialog.
Gets or sets the CSS class of the dialog.
Gets or sets the wrapper CSS class of the dialog.
Gets or sets the content CSS class of the dialog.
Gets or sets a value indicating whether to auto-focus the first element in the
dialog.
CloseDialogOnOverlayClick
Gets or sets a value indicating whether to close the dialog when the overlay
is clicked.
Gets or sets a value indicating whether to close the dialog when the escape
key is pressed.
Gets or sets the resize action of the dialog.
Gets or sets the drag action of the dialog.
Styling Classes
The following CSS classes are applied by the Dialog components:
dialog-titlebar – Dialog title bar
dialog-title – Dialog title element
dialog-titlebar-close – Close button in title bar
dialog-content – Dialog content area
dialog-mask – Background overlay mask
dialog-header – Dialog header section
dialog-description – Dialog description element
For more examples, visit the Storybook.