Dialog
Imperative dialog service; show dialogs via IDialogService.Show. Requires DialogProvider in layout.
Installation
Add the Dialog component using the CLI:
Usage
ShadcnBlazor supports two dialog APIs: imperative (via IDialogService.Show<T>()) and declarative (via DialogRoot, DialogTrigger, DialogContent, etc.). For imperative dialogs, add DialogProvider to your layout, inject IDialogService, and call Show<YourDialogComponent>(title, parameters, options). The declarative API mirrors shadcn/ui React: nest DialogTrigger and DialogContent inside DialogRoot.
Declarative
Compose dialogs inline with DialogRoot, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, and DialogClose.
Single file
Trigger and dialog content in one place. The dialog content component is defined in the code-behind of the same example.
Two files
Trigger and dialog content in separate files. The trigger calls Show<Dialog>; the dialog content lives in its own component.
API Reference
DialogProvider
Provider component that hosts dialogs shown via . Required for imperative dialogs to work.
Methods
| Method | Returns | Description |
|---|---|---|
Dispose |
void |
|
Equals |
bool |
|
GetHashCode |
int |
|
GetType |
Type |
|
SetParametersAsync |
Task |
|
ToString |
string |