Twitter Bootstrap Extension for Yii 2

This is the Twitter Bootstrap extension for Yii framework 2.0. It encapsulates Bootstrap 3 components and plugins in terms of Yii widgets, and thus makes using Bootstrap components/plugins in Yii applications extremely easy.

For license information check the LICENSE-file.

Documentation is at docs/guide/

Latest Stable Version Total Downloads Build Status


The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yiisoft/yii2-bootstrap

or add

"yiisoft/yii2-bootstrap": "~2.0.0"

to the require section of your composer.json file.


For example, the following single line of code in a view file would render a Bootstrap Progress plugin:

<?= yii\bootstrap\Progress::widget(['percent' => 60, 'label' => 'test']) ?>

Class Reference

Class Description
yii\bootstrap\ActiveField A Bootstrap 3 enhanced version of yii\widgets\ActiveField.
yii\bootstrap\ActiveForm A Bootstrap 3 enhanced version of yii\widgets\ActiveForm.
yii\bootstrap\Alert Alert renders an alert bootstrap component.
yii\bootstrap\BaseHtml BaseHtml provides concrete implementation for yii\bootstrap\Html.
yii\bootstrap\BootstrapAsset Asset bundle for the Twitter bootstrap css files.
yii\bootstrap\BootstrapPluginAsset Asset bundle for the Twitter bootstrap javascript files.
yii\bootstrap\BootstrapThemeAsset Asset bundle for the Twitter bootstrap default theme.
yii\bootstrap\BootstrapWidgetTrait BootstrapWidgetTrait is the trait, which provides basic for all bootstrap widgets features.
yii\bootstrap\Button Button renders a bootstrap button.
yii\bootstrap\ButtonDropdown ButtonDropdown renders a group or split button dropdown bootstrap component.
yii\bootstrap\ButtonGroup ButtonGroup renders a button group bootstrap component.
yii\bootstrap\Carousel Carousel renders a carousel bootstrap javascript component.
yii\bootstrap\Collapse Collapse renders an accordion bootstrap javascript component.
yii\bootstrap\Dropdown Dropdown renders a Bootstrap dropdown menu component.
yii\bootstrap\Html Html is an enhanced version of yii\helpers\Html helper class dedicated to the Bootstrap needs.
yii\bootstrap\InputWidget InputWidget is an adjusted for bootstrap needs version of yii\widgets\InputWidget.
yii\bootstrap\Modal Modal renders a modal window that can be toggled by clicking on a button.
yii\bootstrap\Nav Nav renders a nav HTML component.
yii\bootstrap\NavBar NavBar renders a navbar HTML component.
yii\bootstrap\Progress Progress renders a bootstrap progress bar component.
yii\bootstrap\Tabs Tabs renders a Tab bootstrap javascript component.
yii\bootstrap\ToggleButtonGroup ToggleButtonGroup allows rendering form inputs Checkbox/Radio toggle button groups.
yii\bootstrap\Widget \yii\bootstrap\Widget is the base class for all bootstrap widgets.