Blazorise Modal Provider API
Review the provider component and service methods used to create and manage modal instances.
For setup instructions and examples, see the Modal Provider documentation.
API
Parameters
| Parameter | Description | Type | Default |
|---|---|---|---|
Animated |
Determines whether the component has any animations. Global Option. |
bool | true |
AnimationDuration |
Specifies the animation duration. Global Option. |
int | 150 |
Centered |
Centers the modal vertically. RemarksOnly considered if UseModalStructure is set. |
bool | false |
FocusTrap |
Specifies if the modal should keep the input focus at all times. Global Option. |
bool? | null |
ProviderName |
Defines the provider name used by IModalService. When null or empty, this provider is used as the default provider. |
string | |
RenderMode |
Specifies how the modal content will be rendered. Global Option. Possible values: |
ModalRenderMode | ModalRenderMode.Default |
Scrollable |
Scrolls the modal content independent of the page itself. RemarksOnly considered if UseModalStructure is set. |
bool | false |
ScrollToTop |
If true modal will scroll to top when opened. Global Option. |
bool | true |
ShowBackdrop |
Specifies the backdrop needs to be rendered for this Modal. Global Option. |
bool | true |
Size |
Changes the size of the modal. Possible values: RemarksOnly considered if UseModalStructure is set. |
ModalSize | ModalSize.Default |
Stateful |
Keeps the ModalInstance in memory after it has been closed. Defaults to false. |
bool | false |
UseModalStructure |
Uses the modal standard structure, by setting this to true you are only in charge of providing the custom content. Defaults to true. Global Option. |
bool | true |
Events
| Event | Description | Type |
|---|---|---|
Closed |
Occurs after the modal has closed. Global Option. |
EventCallback |
Closing |
Occurs before the modal is closed. Global Option. |
Func<ModalClosingEventArgs, Task> |
Opened |
Occurs after the modal has opened. Global Option. |
EventCallback |
Opening |
Occurs before the modal is opened. Global Option. |
Func<ModalOpeningEventArgs, Task> |
IModalService
Properties
| Property | Description | Type |
|---|---|---|
ModalProvider |
Gets the default provider that manages modal instances. | ModalProvider |
Methods
| Method | Description | Return | Parameters |
|---|---|---|---|
SetModalProvider |
Sets the default modal provider. | void | ModalProvider modalProvider |
RegisterModalProvider |
Registers a named provider, or the default provider when the name is empty. | void | string providerName, ModalProvider modalProvider |
UnregisterModalProvider |
Unregisters a named or default provider. | void | string providerName, ModalProvider modalProvider |
Show<TComponent> |
Shows a component in a modal. Overloads support a title, component parameters, and instance options. | Task<ModalInstance> | title, parameters, options (depending on overload) |
Show |
Shows dynamically selected component content or a render fragment. | Task<ModalInstance> | component type or RenderFragment, with optional title and options |
Show |
Reopens an existing modal instance. | Task | ModalInstance modalInstance |
Hide |
Hides the latest modal, a modal from a named provider, or a specific instance. | Task | provider name or ModalInstance (optional) |
GetInstances |
Returns the modal instances managed by the default provider. | IEnumerable<ModalInstance> | |
Remove |
Removes a modal instance from its provider. | Task | ModalInstance modalInstance |
Reset |
Clears the modal provider state and its tracked instances. | Task |