PSC.Blazor.Components.Modals
6.0.4
See the version list below for details.
dotnet add package PSC.Blazor.Components.Modals --version 6.0.4
NuGet\Install-Package PSC.Blazor.Components.Modals -Version 6.0.4
<PackageReference Include="PSC.Blazor.Components.Modals" Version="6.0.4" />
paket add PSC.Blazor.Components.Modals --version 6.0.4
#r "nuget: PSC.Blazor.Components.Modals, 6.0.4"
// Install PSC.Blazor.Components.Modals as a Cake Addin #addin nuget:?package=PSC.Blazor.Components.Modals&version=6.0.4 // Install PSC.Blazor.Components.Modals as a Cake Tool #tool nuget:?package=PSC.Blazor.Components.Modals&version=6.0.4
Modals for Blazor
This component helps you to create modal windows and modal popup in your Blazor application.
Install
In your index.html
you have to add the style in the head of the page and the script at the bottom like
<link href="_content/PSC.Blazor.Components.Modals/themes/default.css" rel="stylesheet" />
<script src="_content/PSC.Blazor.Components.Modals/js/pscmodals.js"></script>
Then, in your MainLayout.razor
you have to place the container for the modals adding
<ModalContainer />
So, the component it is ready to use. In the Razor
page when you want to use this controller, you have to inject the IModalService
adding
@inject IModalService ModalService
Use embedded modal
In the component the embedded modal allow you to show a message and wait for the interaction from the user. You can create a simple box with a message and an Ok
button with the following code:
await ModalService.ShowDialogAsync(new DialogOptions
{
MainText = "You have a new message",
SubText = "Check your inbox for more information",
CancelText = "",
IconElements = SVGIcons.Message,
StatusColor = "#1e293b"
});
IconElement
is a SVG image and for that you can use my other component PSC.Blazor.Components.Icons.
If you want to display a message box with 2 buttons (for example Ok and Cancel), the code is the following
var result = await ModalService.ShowDialogAsync(new DialogOptions
{
MainText = "Are you sure?",
SubText = "Please note this can not be undone",
IconElements = SVGIcons.Question_mark,
StatusColor = "#ff0000"
});
If you want to display your own Razor
component in the modal, you can use the following code:
private ModalOptions modalOptions = new ModalOptions { Size = ModalSize.Large, Draggable = true };
var component = new RenderComponent<YourRazorComponent>();
var result = await ModalService.ShowAsync("This is a Title", component, modalOptions);
Options
Name | Description | Default |
---|---|---|
ShowHeader | Display the header of the modal window | True |
Scrollable | If necessary, display the scrollbars | True |
CloseOnClickOutside | If the user clicks outside the modal window, the modal will close | False |
BlurBackground | When the modal is displayed, the background is blur | True |
Backdrop | True | |
CloseOnEc | ||
Draggable | The modal is draggable | False |
VerticalPosition | Define the vertical position of the window | |
Size | ||
Fullscreen | Never | |
StatusColor | The color of the status of the window | #ffffff |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net6.0
- Microsoft.AspNetCore.Components.Web (>= 6.0.0)
- PSC.Blazor.Components.Common (>= 6.0.4)
- PSC.Blazor.Components.Icons (>= 6.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.