Yii widgets =========== Most complex bootstrap components are wrapped into Yii widgets to allow more robust syntax and integrate with framework features. All widgets belong to `\yii\bootstrap` namespace: - [[yii\bootstrap\ActiveForm|ActiveForm]] - [[yii\bootstrap\Alert|Alert]] - [[yii\bootstrap\Button|Button]] - [[yii\bootstrap\ButtonDropdown|ButtonDropdown]] - [[yii\bootstrap\ButtonGroup|ButtonGroup]] - [[yii\bootstrap\Carousel|Carousel]] - [[yii\bootstrap\Collapse|Collapse]] - [[yii\bootstrap\Dropdown|Dropdown]] - [[yii\bootstrap\Modal|Modal]] - [[yii\bootstrap\Nav|Nav]] - [[yii\bootstrap\NavBar|NavBar]] - [[yii\bootstrap\Progress|Progress]] - [[yii\bootstrap\Tabs|Tabs]] ## Customizing widget CSS classes These widgets allow quick composition of the HTML for the Bootstrap components that require the use of the Bootstrap CSS classes. The default class for the component is added automatically by the widget, and the optional classes that you may want to customize are usually supported through the properties of the widget. For example, you may use [[yii\bootstrap\Button::options]] to customize the appearance of a button. The class 'btn' which is required for a button will be added automatically, so you don't need to worry about it. All you need is specify a particular button class: ```php echo Button::widget([ 'label' => 'Action', 'options' => ['class' => 'btn-primary'], // produces class "btn btn-primary" ]); ``` However, sometimes you may need to replace the default class with an alternative one. For example, the widget [[yii\bootstrap\ButtonGroup]] uses 'btn-group' class for the container div by default, but you may need to use 'btn-group-vertical' instead to align the buttons vertically. Using a plain 'class' option simply adds 'btn-group-vertical' to 'btn-group', which will produce an incorrect result. In order to override the default class of a widget, you need to specify the 'class' option as an array that contains the customized class name under the 'widget' key: ```php echo ButtonGroup::widget([ 'options' => [ 'class' => ['widget' => 'btn-group-vertical'] // replaces 'btn-group' with 'btn-group-vertical' ], 'buttons' => [ ['label' => 'A'], ['label' => 'B'], ] ]); ```