Skip to content

BerserkerDotNet/BlazorBootstrap.Modal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlazorBootstrap.Modal

Bootstrap 4 modal dialog for Asp.NET Blazor

Build Status

Prerequisites

Bootstrap 4, usually included with default Blazor template.

Setup

  1. Install BlazorBootstrap.Modal from NuGet by PowerShell:
    Install-Package BlazorBootstrap.Modal
    or via dotnet CLI
    dotnet add package BlazorBootstrap.Modal
  2. Register services in Startup.cs
    services.AddBootstrapModal();
  3. Add modal to layout MainLayout.razor file
    <BootstrapModal />

Usage

  1. Create modal dialog, for example SimpleModal.razor:

    <p>Simple bootstrap 4 modal.</p>
    <span>Parameter: @SampleParameter</span>
    
    @code{
        [Parameter] string SampleParameter { get; set; }
    }
  2. Inject modal service into your class

    @inject IModal Modal
  3. Invoke modal:

        Modal.Show<SimpleModal>("Simple modal", ModalParameter.Get("SampleParameter", "This is a parameter"))

    where the first parameter is title of the modal window and second is a list of parameters to pass to the modal class.

    For more example refer to the BlazorBootstrap.Modal.Samples project.

About

Bootstrap modal dialog for Asp.NET Blazor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published