Popconfirm
Angular Bootstrap 5 Popconfirm component
Responsive popconfirm built with Bootstrap 5, Angular and Material Design. Popconfirm is a compact dialog alert. Use it to confirm/cancel a decision or display extra content like an explanation.
Popconfirm basically is a simple alert with confirmation buttons.
Note: Read the API tab to find all available options and advanced customization
Basic example
Basic example of popconfirm usage
You can create popconfirm dynamically from any component using a built-in service. To achieve this, follow these steps:
1. Create a new component with Angular CLI and add some HTML code to the template.
ng generate component popconfirm
2. Inject MdbPopconfirmService
to the component from which you want to open the
popconfirm and use the open
method.
Inject and receive data
You can inject data to the modal by passing it to the data
parameter in the popconfirm
options.
Here is an example showing how to use injected data in the popconfirm component:
Receive data from the popconfrim
You can receive data from the popconfirm to use it in other components:
Here is an example showing how to use data received from popconfirmRef in other components
Display mode
You can choose between modal
and inline
to modify display mode.
Modal mode is rendered at the center of the screen and is static, you can't change its position but all other attributes can be applied
Icon example
You can add an icon to the message in the popconfirm by customizing the template
Inline positions
You can choose between different positions
Available positions:
top left; top; top right; right top; right; right bottom; bottom right; bottom; bottom
left; left bottom; left; left top;
Popconfirm - API
Import
Options
Name | Type | Default | Description |
---|---|---|---|
popconfirmMode |
String | 'inline' |
Mode of display -> 'inline' or 'modal' |
position
|
String | '' |
Specify position to display popover |
Methods
MdbPopconfirmService
Method | Description |
---|---|
open(componentType, target, config?: MdbPopconfirmConfig<D>)
|
Open Popconfirm. |
MdbPopconfirmRef
Method | Description |
---|---|
onClose: Observable<any> |
Returns observable on popconfirm close. |
onConfirm: Observable<any> |
Returns observable on popconfirm confirm. |
CSS variables
As part of MDB’s evolving CSS variables approach, popconfirm now use local CSS variables on .popconfirm
for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.
Popconfirm's CSS variables are in different classes which belong to this component. To make it easier to use them, you can find below all of the used CSS variables.