Jipetco.Packages.ConfirmationDialog 1.6.0

dotnet add package Jipetco.Packages.ConfirmationDialog --version 1.6.0                
NuGet\Install-Package Jipetco.Packages.ConfirmationDialog -Version 1.6.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Jipetco.Packages.ConfirmationDialog" Version="1.6.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Jipetco.Packages.ConfirmationDialog --version 1.6.0                
#r "nuget: Jipetco.Packages.ConfirmationDialog, 1.6.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Jipetco.Packages.ConfirmationDialog as a Cake Addin
#addin nuget:?package=Jipetco.Packages.ConfirmationDialog&version=1.6.0

// Install Jipetco.Packages.ConfirmationDialog as a Cake Tool
#tool nuget:?package=Jipetco.Packages.ConfirmationDialog&version=1.6.0                

Jipetco.Packages.ConfirmationDialog

A Blazor component for displaying a customizable confirmation dialog. This component is designed to be flexible and easy to use, allowing you to quickly add confirmation dialogs to your Blazor applications.

Installation

To install the package, run the following command in the Package Manager Console:

Or use the .NET CLI:

dotnet add package Jipetco.Packages.ConfirmationDialog

Usage

  1. Use the ConfirmationDialog component in your Blazor page or component.

@page "/example"

<ConfirmationDialog @ref="confirmationDialog" ConfirmationChanged="OnConfirmationChanged" ConfirmationTitle="Delete Item" ConfirmationMessage="Are you sure you want to delete this item?" ConfirmationMessageTextColor="text-danger" ConfirmButtonColor="btn-danger" HeaderBgColor="bg-danger" HeaderTextColor="text-white" /> <button @onclick="ShowConfirmationDialog">Show Confirmation Dialog</button>

@code {

private ConfirmationDialog confirmationDialog;

private void ShowConfirmationDialog()
{
    confirmationDialog.Show();
}

private async Task OnConfirmationChanged(bool confirmed)
{
    if (confirmed)
    {
        // Handle the confirmation action
    }
}

}
  1. Customize the dialog by setting the parameters:
  • ConfirmationTitle: The title of the confirmation dialog.
  • ConfirmationMessage: The message displayed in the confirmation dialog.
  • ConfirmationMessageTextColor: The text color of the confirmation message.
  • ConfirmButtonColor: The color of the confirm button.
  • HeaderBgColor: The background color of the header.
  • HeaderTextColor: The text color of the header.

Parameters

Parameter Type Default Value Description
ShowConfirmation bool false Controls the visibility of the confirmation dialog.
ConfirmationChanged EventCallback<bool> null Event callback triggered when the confirmation state changes.
ConfirmationTitle string? "Delete Confirmation" The title of the confirmation dialog.
ConfirmationMessage string? "Are you sure you want to delete?" The message displayed in the confirmation dialog.
ConfirmationMessageTextColor string? "danger" The text color of the confirmation message.
ConfirmButtonColor string? "danger" The color of the confirm button.
HeaderBgColor string? "danger" The background color of the header.
HeaderTextColor string? "danger" The text color of the header.

Methods

  • Show(): Displays the confirmation dialog.

Example

Here is a complete example of how to use the ConfirmationDialog component in a Blazor application:

@page "/example"

<ConfirmationDialog @ref="confirmationDialog" ConfirmationChanged="OnConfirmationChanged" ConfirmationTitle="Delete Item" ConfirmationMessage="Are you sure you want to delete this item?" ConfirmationMessageTextColor="text-danger" ConfirmButtonColor="btn-danger" HeaderBgColor="bg-danger" HeaderTextColor="text-white" /> <button @onclick="ShowConfirmationDialog">Show Confirmation Dialog</button>

@code {

private ConfirmationDialog confirmationDialog;

private void ShowConfirmationDialog()
{
    confirmationDialog.Show();
}

private async Task OnConfirmationChanged(bool confirmed)
{
    if (confirmed)
    {
        // Handle the confirmation action
    }
}

}

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes.

Contact

For any questions or feedback, please contact [peter.oganwu@jipetcoresources.ca].

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.6.0 66 11/16/2024
1.4.0 70 11/15/2024
1.2.0 267 2/1/2024
1.0.0 115 2/1/2024