bootstrap-widgets.md 1.43 KB
Newer Older
1 2
Bootstrap widgets
=================
3

4 5
Yii includes support of [Bootstrap 3](http://getbootstrap.com/) markup and components framework out of the box. It is an
excellent framework that allows you to speed up development a lot.
6

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Bootstrap is generally about two parts:

- Basics such as grid system, typography, helper classes and responsive utilities.
- Ready to use components such as menus, pagination, modal boxes, tabs etc.

Basics
------

Yii doesn't wrap bootstrap basics into PHP code since HTML is very simple by itself in this case. You can find details
about using the basics at [bootstrap documentation website](http://getbootstrap.com/css/). Still Yii provides a
convenient way to include bootstrap assets in your pages with a single line added to `AppAsset.php` located in your
`config` directory:

```php
public $depends = array(
	'yii\web\YiiAsset',
	'yii\bootstrap\BootstrapAsset', // this line
24
	// 'yii\bootstrap\BootstrapThemeAsset' // uncomment to apply bootstrap 2 style to bootstrap 3
25 26 27
);
```

28
Using bootstrap through Yii asset manager allows you to minimize its resources and combine with your own resources when
29 30 31 32 33 34
needed.

Yii widgets
-----------

Most complex bootstrap components are wrapped into Yii widgets to allow more robust syntax and integrate with
35 36 37 38 39 40 41 42 43 44 45 46 47 48
framework features. All widgets belong to `\yii\bootstrap` namespace:

- Alert
- Button
- ButtonDropdown
- ButtonGroup
- Carousel
- Collapse
- Dropdown
- Modal
- Nav
- NavBar
- Progress
- Tabs