ModalService
BitModalService is a service to globally handle modals with any content.
Notes
To use this component, you need to install the
Bit.BlazorUI.Extras
nuget package, as described in the Optional steps of the
Getting started page.
Usage
Basic
<BitButton OnClick="ShowModal">Show</BitButton> <BitModalContainer ModalParameters="new() { AutoToggleScroll = true }" />@code { [AutoInject] private BitModalService modalService = default!; private async Task ShowModal() { await modalService.Show<ModalContent>(new BitModalParameters() { Draggable = true }); } }
API
BitModalService parameters
Name |
Type |
Default value |
Description |
|---|---|---|---|
| OnAddModal | event Func<BitModalReference, Task>? | The event for when a new modal gets added through calling the Show method. | |
| OnCloseModal | event Func<BitModalReference, Task>? | The event for when a modal gets removed through calling the Close method. | |
| Close | void (BitModalReference modal) | Closes an already opened modal using its reference. | |
| Show | Task<BitModalReference> (Dictionary<string, object>? parameters) | Shows a new BitModal with a custom component with parameters as its content. | |
| Show | Task<BitModalReference> (BitModalParameters? modalParameters) | Shows a new BitModal with a custom component as its content with custom parameters for the modal. | |
| Show | Task<BitModalReference> (Dictionary<string, object>? parameters, BitModalParameters? modalParameters) | Shows a new BitModal with a custom component as its content with custom parameters for the custom component and the modal. |
Feedback
You can give us your feedback through our GitHub repo by filing a new Issue or starting a new Discussion.
Or you can review / edit this page on GitHub.
Or you can review / edit this component on GitHub.
- On this page