How To Create UIkit Alert Box
To create a UIkit alert box, add the uk-alert
attribute to the block element.
UIkit alert box component is used to create different types of alert messages such as success, warning, danger, error, etc. UIkit provides the followings types of alert boxes:primary
, success
, warning
, danger
.
To create a UIkit alert box, add the uk-alert
attribute to the block element.
General Syntax
<div uk-alert>
Alert box With Close Button
<a class="uk-alert-close" uk-close></a>
</div>
Source Code
<div class="uk-container">
<div uk-alert>This is an alert box.</div>
</div>
<!--/container-->
Source Code : Output
The above source code result will be:
To create UIkit alert box with close button, add the .uk-alert-close
class and uk-close
attribute to a <button>
or <a>
element inside the alert box having attribute uk-alert
.
General Syntax
<div uk-alert>
<p>This is an alert box with close button.</p>
<a class="uk-alert-close" uk-close></a>
</div>
Source Code
<div uk-alert>
<p>This is an alert box with close button.</p>
<a class="uk-alert-close" uk-close></a>
</div>
Source Code : Output
The above source code result will be:
The primary alert box can be created by adding the .uk-alert-primary
class and the uk-alert
attribute to the alert container.
General Syntax
<div class="uk-alert-primary" uk-alert>
<a class="uk-alert-close" uk-close></a>
<p>Primary Alert Box</p>
</div>
Source Code
<div class="uk-alert-primary" uk-alert>
<a class="uk-alert-close" uk-close></a>
<p>Primary Alert Box</p>
</div>
Source Code : Output
The above source code result will be:
The success alert box can be created by adding the .uk-alert-success
class and the uk-alert
attribute to the alert container.
General Syntax
<div class="uk-alert-success" uk-alert>
<a class="uk-alert-close" uk-close></a>
</div>
Source Code
<div class="uk-alert-success" uk-alert>
<a class="uk-alert-close" uk-close></a>
<p>Success Alert Box.</p>
</div>
Source Code : Output
The above source code result will be:
Uikit warning alert box can be created by adding the .uk-alert-success
class and the uk-alert
attribute to the alert container.
General Syntax
<div class="uk-alert-warning" uk-alert>
<a class="uk-alert-close" uk-close></a>
</div>
Source Code
<div class="uk-alert-warning" uk-alert>
<a class="uk-alert-close" uk-close></a>
<p>Warning Alert Box.</p>
</div>
Source Code : Output
The above source code result will be:
UIkit danger alert box can be created by adding the .uk-alert-danger
class and the uk-alert
attribute to the alert container.
General Syntax
<div class="uk-alert-danger" uk-alert>
<a class="uk-alert-close" uk-close></a>
</div>
Source Code
<div class="uk-alert-danger" uk-alert>
<a class="uk-alert-close" uk-close></a>
<p>UIkit Danger Alert Box</p>
</div>
Source Code : Output
The above source code result will be: