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

ParameterDefaultType
Animatedtruebool

Determines whether the component has any animations. Global Option.
AnimationDuration150int

Specifies the animation duration. Global Option.
Centeredfalsebool

Centers the modal vertically.
Only considered if UseModalStructure is set.
FocusTraptruebool?

Specifies if the modal should keep the input focus at all times. Global Option.
When unspecified, uses BlazoriseOptions.ModalFocusTrap, falling back to true.
ProviderName—string

Defines the provider name used by IModalService. When null or empty, this provider is used as the default provider.
RenderModeModalRenderMode.DefaultModalRenderMode

Specifies how the modal content will be rendered. Global Option.
Possible values:DefaultLazyLoadLazyReload
Scrollablefalsebool

Scrolls the modal content independent of the page itself.
Only considered if UseModalStructure is set.
ScrollToToptruebool

If true modal will scroll to top when opened. Global Option.
ShowBackdroptruebool

Specifies the backdrop needs to be rendered for this Modal. Global Option.
SizeModalSize.DefaultModalSize

Changes the size of the modal.
Possible values:DefaultSmallLargeExtraLargeFullscreen
Only considered if UseModalStructure is set.
Statefulfalsebool

Keeps the ModalInstance in memory after it has been closed. Defaults to false.
UseModalStructuretruebool

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.

Events

EventType
ClosedEventCallback

Occurs after the modal has closed. Global Option.
ClosingFunc<ModalClosingEventArgs, Task>

Occurs before the modal is closed. Global Option.
OpenedEventCallback

Occurs after the modal has opened. Global Option.
OpeningFunc<ModalOpeningEventArgs, Task>

Occurs before the modal is opened. Global Option.

ModalProvider properties

Properties

PropertyType
TopMostModalInstance

Gets the most recently activated visible modal instance, or null when no modal is visible.

IModalService

Properties

PropertyType
ModalProviderModalProvider

Gets the default provider that manages modal instances.

Methods

MethodReturnParameters
SetModalProvidervoidModalProvider modalProvider

Sets the default modal provider.
RegisterModalProvidervoidstring providerName, ModalProvider modalProvider

Registers a named provider, or the default provider when the name is empty.
UnregisterModalProvidervoidstring providerName, ModalProvider modalProvider

Unregisters a named or default provider.
Show<TComponent>Task<ModalInstance>title, parameters, options (depending on overload)

Shows a component in a modal. Overloads support a title, component parameters, and instance options.
ShowTask<ModalInstance>component type or RenderFragment, with optional title and options

Shows dynamically selected component content or a render fragment.
ShowTaskModalInstance modalInstance

Reopens an existing modal instance.
HideTaskprovider name or ModalInstance (optional)

Hides the latest modal, a modal from a named provider, or a specific instance.
GetInstancesIEnumerable<ModalInstance>—

Returns the modal instances managed by the default provider.
RemoveTaskModalInstance modalInstance

Removes a modal instance from its provider.
ResetTask—

Clears the modal provider state and its tracked instances.
On this page