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
<PackageReference Include="Jipetco.Packages.ConfirmationDialog" Version="1.6.0" />
paket add Jipetco.Packages.ConfirmationDialog --version 1.6.0
#r "nuget: Jipetco.Packages.ConfirmationDialog, 1.6.0"
// 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
- 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
}
}
}
- 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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. |
-
net9.0
- Microsoft.AspNetCore.Components.Web (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.