Class yii\bootstrap\Button

Inheritanceyii\bootstrap\Button » yii\bootstrap\Widget » yii\base\Widget
Uses Traitsyii\bootstrap\BootstrapWidgetTrait
Available since version2.0
Source Code https://github.com/yiisoft/yii2-bootstrap/blob/master/src/Button.php

Button renders a bootstrap button.

For example,

echo Button::widget([
    'label' => 'Action',
    'options' => ['class' => 'btn-lg'],
]);

See also http://getbootstrap.com/javascript/#buttons.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$clientEvents array The event handlers for the underlying Bootstrap JS plugin. yii\bootstrap\BootstrapWidgetTrait
$clientOptions array The options for the underlying Bootstrap JS plugin. yii\bootstrap\BootstrapWidgetTrait
$encodeLabel boolean Whether the label should be HTML-encoded. yii\bootstrap\Button
$label string The button label yii\bootstrap\Button
$options array The HTML attributes for the widget container tag. yii\bootstrap\Widget
$tagName string The tag to use to render the button yii\bootstrap\Button

Public Methods

Hide inherited methods

MethodDescriptionDefined By
getView() yii\bootstrap\BootstrapWidgetTrait
init() Initializes the widget. yii\bootstrap\Button
run() Renders the widget. yii\bootstrap\Button

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
registerClientEvents() Registers JS event handlers that are listed in $clientEvents. yii\bootstrap\BootstrapWidgetTrait
registerPlugin() Registers a specific Bootstrap plugin and the related events yii\bootstrap\BootstrapWidgetTrait

Property Details

$encodeLabel public property

Whether the label should be HTML-encoded.

public boolean $encodeLabel true
$label public property

The button label

public string $label 'Button'
$tagName public property

The tag to use to render the button

public string $tagName 'button'

Method Details

init() public method

Initializes the widget.

If you override this method, make sure you call the parent implementation first.

public void init ( )
run() public method

Renders the widget.

public void run ( )