You can download a minimized version of the library or get the full source code at github.com.
Download source$ npm install coreui-alert
<button id="alert-default" class="btn btn-secondary">Default</button>
<button id="alert-warning" class="btn btn-warning">Warning</button>
<button id="alert-danger" class="btn btn-danger">Danger</button>
<button id="alert-success" class="btn btn-success">Success</button>
<button id="alert-info" class="btn btn-info">Info</button>
<script>
$('#alert-default').click(function () {
CoreUI.alert.default("Alert title", "Raw denim you probably haven't heard of them jean shorts Austin?");
});
$('#alert-warning').click(function () {
CoreUI.alert.warning("Alert title", "Raw denim you probably haven't heard of them jean shorts Austin?");
});
$('#alert-danger').click(function () {
CoreUI.alert.danger('Alert title', "Raw denim you probably haven't heard of them jean shorts Austin?");
});
$('#alert-success').click(function () {
CoreUI.alert.success('Alert title', "Raw denim you probably haven't heard of them jean shorts Austin?");
});
$('#alert-info').click(function () {
CoreUI.alert.info("Alert title", "Raw denim you probably haven't heard of them jean shorts Austin?");
});
</script>
<button id="confirm-default" class="btn btn-secondary">Default</button>
<button id="confirm-warning" class="btn btn-warning">Warning</button>
<button id="confirm-danger" class="btn btn-danger">Danger</button>
<script>
$('#confirm-default').click(function () {
CoreUI.alert.default(
"Confirm title",
"Raw denim you probably haven't heard of them jean shorts Austin?",
{
buttons: [
{ text: "Cancel", click: function () { console.log('Cancel') }, },
{ text: "Ok", click: function () { console.log('Ok') }, }
]
}
);
});
$('#confirm-warning').click(function () {
CoreUI.alert.warning(
"Confirm title",
"Raw denim you probably haven't heard of them jean shorts Austin?",
{
buttons: [
{ text: "Cancel", click: function () { console.log('Cancel') }, },
{ text: "Sign", type: 'warning', click: function () { console.log('Sign') }, }
]
}
);
});
$('#confirm-danger').click(function () {
CoreUI.alert.danger(
'Confirm title',
"Raw denim you probably haven't heard of them jean shorts Austin?",
{
buttons: [
{ text: "Cancel", click: function () { console.log('Cancel') }, },
{ text: "Delete", type: 'danger', click: function () { console.log('Delete') }, }
]
}
);
});
</script>
<button id="alert-html" class="btn btn-secondary">Show</button>
<script>
$('#alert-html').click(function () {
CoreUI.alert.create({
html: '<strong>HTML <u>example</u></strong>' +
'<p>You can use <b>bold text</b>, <a href="#">links</a> and other HTML tags</p>' +
'<table class="table mt-4">' +
'<tbody>' +
'<tr><th>1</th><td>Mark</td><td>Otto</td><td>@mdo</td></tr>' +
'<tr><th>2</th><td>Jacob</td><td>Thornton</td><td>@fat</td></tr>' +
'</tbody>' +
'</table>',
buttons: [
{ text: 'Ok', click: function () { console.log('Ok') }, }
]
});
});
</script>
<button id="alert-custom" class="btn btn-primary">Show</button>
<script>
$('#alert-custom').click(function () {
CoreUI.alert.create({
type: 'info',
title: "Custom alert",
message: "Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.",
buttons: [
{ text: "Cancel", type: 'secondary', click: function () { console.log('Cancel') }, },
{ text: "Reject", type: 'warning', click: function () { console.log('Reject') }, },
{ text: "Accept", type: 'success', click: function () { console.log('Accept') }, },
]
});
});
</script>
Name | type | default | description |
---|---|---|---|
type | string | Тип уведомления. Доступные варианты: default, warning, danger, success, info |
|
title | string | Заголовок уведомления | |
message | string | Содержимое уведомления | |
html | string | HTML содержимое уведомления | |
showClose | boolean | true | Отображение кнопки закрытия уведомления |
buttons | array | Список кнопок на панели уведомления | |
onShow | function|string | Событие происходящее при открытии уведомления | |
onHide | function|string | Событие происходящее при закрытии уведомления |
Method | Description |
---|---|
CoreUI.alert.default( title, message, options ) |
Показ стандартного уведомления без стилизации |
CoreUI.alert.warning( title, message, options ) |
Показ уведомления с предупреждением |
CoreUI.alert.danger( title, message, options ) |
Показ уведомления с опасностью |
CoreUI.alert.success( title, message, options ) |
Показ уведомления об успешным событии |
CoreUI.alert.info( title, message, options ) |
Показ информационного сообщения |
CoreUI.alert.question( title, message, options ) |
Показ вопросительного сообщения |
CoreUI.alert.create( options ) |
Показ сообщения |