Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

PSC.Blazor.Components.Modals

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

PSC.Blazor.Components.Modals

Modal popup windows for Blazor

nugetNuGet
Version
8.0.3
Version published
Maintainers
1
Created
Source

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>

In .NET6 or above in the Program.cs you have to add those lines

builder.Services.AddSingleton<ModalsService>();
builder.Services.AddScoped<IModalService, ModalService>();

The ModalsService manages the list of windows across the application and ModalService is the component for a single window to inject in your page.

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

In your _Imports.razor it could be required to add the following lines:

@using PSC.Blazor.Components.Modals
@using PSC.Blazor.Components.Modals.Enums
@using PSC.Blazor.Components.Modals.Interfaces
@using PSC.Blazor.Components.Modals.Models

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

NameDescriptionDefault
ShowHeaderDisplay the header of the modal windowTrue
ScrollableIf necessary, display the scrollbarsTrue
CloseOnClickOutsideIf the user clicks outside the modal window, the modal will closeFalse
BlurBackgroundWhen the modal is displayed, the background is blurTrue
BackdropShow if the modal dialog has to hide the background.True
CloseOnEscAllow to close the modal window pressing the ESC key
DraggableThe modal is draggableFalse
VerticalPositionDefine the vertical position of the window
SizeSize of the modal window
FullscreenAllow the modal window to be full screenNever
StatusColorThe color of the status of the window#ffffff

PureSourceCode.com

PureSourceCode.com is my personal blog where I publish posts about technologies and in particular source code and projects in .NET.

In the last few months, I created a lot of components for Blazor WebAssembly and Blazor Server.

My name is Enrico Rossini and you can contact me via:

Blazor Components

Component nameForumNuGetWebsiteDescription
AnchorLinkForumNuGet badgeAn anchor link is a web link that allows users to leapfrog to a specific point on a website page. It saves them the need to scroll and skim read and makes navigation easier. This component is for Blazor WebAssembly and Blazor Server
Autocomplete for BlazorForumNuGet badgeSimple and flexible autocomplete type-ahead functionality for Blazor WebAssembly and Blazor Server
Browser Detect for BlazorForumNuGet badgeDemoBrowser detect for Blazor WebAssembly and Blazor Server
ChartJs for BlazorForumNuGet badgeDemoAdd beautiful graphs based on ChartJs in your Blazor application
Clippy for BlazorForumNuGet badgeDemoDo you miss Clippy? Here the implementation for Blazor
CodeSnipper for BlazorForumNuGet badgeAdd code snippet in your Blazor pages for 196 programming languages with 243 styles
Copy To ClipboardForumNuGet badgeAdd a button to copy text in the clipboard
DataTable for BlazorForumNuGet badgeDemoDataTable component for Blazor WebAssembly and Blazor Server
Google Tag ManagerForumNuGet badgeDemoAdds Google Tag Manager to the application and manages communication with GTM JavaScript (data layer).
Icons and flags for BlazorForumNuGet badgeLibrary with a lot of SVG icons and SVG flags to use in your Razor pages
ImageSelect for BlazorForumNuGet badgeThis is a Blazor component to display a dropdown list with images based on ms-Dropdown by Marghoob Suleman. This component is built with NET7 for Blazor WebAssembly and Blazor Server
Markdown editor for BlazorForumNuGet badgeDemoThis is a Markdown Editor for use in Blazor. It contains a live preview as well as an embeded help guide for users.
Modal dialog for BlazorForumNuGet badgeSimple Modal Dialog for Blazor WebAssembly
Modal windows for BlazorForumNuGet badgeModal Windows for Blazor WebAssembly
Quill for BlazorForumNuGet badgeQuill Component is a custom reusable control that allows us to easily consume Quill and place multiple instances of it on a single page in our Blazor application
ScrollTabsNuGet badgeTabs with nice scroll (no scrollbar) and responsive
Segment for BlazorForumNuGet badgeThis is a Segment component for Blazor Web Assembly and Blazor Server
Tabs for BlazorForumNuGet badgeThis is a Tabs component for Blazor Web Assembly and Blazor Server
Timeline for BlazorForumNuGet badgeThis is a new responsive timeline for Blazor Web Assembly and Blazor Server
Toast for BlazorForumNuGet badgeToast notification for Blazor applications
Tours for BlazorForumNuGet badgeGuide your users in your Blazor applications
TreeView for BlazorForumNuGet badgeThis component is a native Blazor TreeView component for Blazor WebAssembly and Blazor Server. The component is built with .NET7.
WorldMap for BlazorForumNuGet badgeDemoShow world maps with your data

C# libraries for .NET6

Component nameForumNuGetDescription
PSC.EvaluatorForumNuGet badgePSC.Evaluator is a mathematical expressions evaluator library written in C#. Allows to evaluate mathematical, boolean, string and datetime expressions.
PSC.ExtensionsForumNuGet badgeA lot of functions for .NET5 in a NuGet package that you can download for free. We collected in this package functions for everyday work to help you with claim, strings, enums, date and time, expressions...

More examples and documentation

Blazor

Blazor & NET8

Keywords

blazor

FAQs

Package last updated on 08 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts