yii2-widget-alert An extended bootstrap alert and alert block widget for Yii2

  1. Installation
  2. Latest Release
  3. Demo
  4. Usage
  5. License
  6. Report
  7. Resources

Latest Stable Version License Total Downloads Monthly Downloads Daily Downloads

This extension contains a couple of useful widgets. The Alert widget extends the \yii\bootstrap\Alert widget with more easy styling and auto fade out options. In addition, it includes a AlertBlock widget that groups multiple \kartik\widget\Alert or kartik\widget\Growl widgets in one single block and renders them stacked vertically on the current page. You can choose the TYPE_ALERT style or the TYPE_GROWL style for your notifications. You can also set the widget to automatically read and display session flash messages (which is the default setting). Alternatively, you can setup and configure your own block of custom alerts.

> NOTE: This extension is a sub repo split of yii2-widgets. The split has been done since 08-Nov-2014 to allow developers to install this specific widget in isolation if needed. One can also use the extension the previous way with the whole suite of yii2-widgets.


The preferred way to install this extension is through composer. Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json.

To install, either run

$ php composer.phar require kartik-v/yii2-widget-alert "@dev"

or add

"kartik-v/yii2-widget-alert": "@dev"

to the require section of your composer.json file.

Note: Using Growl is optional and it is not automatically installed with this extension. If you want to use it in your project, you need to either run ~~~ $ php composer.phar require kartik-v/yii2-widget-growl "" ~~~ or add ~~~ "kartik-v/yii2-widget-growl": "" ~~~ to the require section of your composer.json file.

Latest Release

Note: The latest version of the module is v1.1.0 released on 19-Nov-2014. Refer the CHANGE LOG for details.


You can refer detailed documentation and demos for Alert and AlertBlock widgets on usage of the extension.


use kartik\alert\Alert;

echo Alert::widget([
	'type' => Alert::TYPE_INFO,
	'title' => 'Note',
	'titleOptions' => ['icon' => 'info-sign'],
	'body' => 'This is an informative alert'
use kartik\alert\AlertBlock;

echo AlertBlock::widget([
	'type' => AlertBlock::TYPE_ALERT,
	'useSessionFlash' => true


yii2-widget-alert is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.



0 0
Yii Version: 2.0
License: BSD-2-Clause
Category: User Interface
Developed by: Kartik V
Created on: Jul 7, 2015
Last updated: 7 years ago

Related Extensions