Yii-Bootstrap

Bringing together the Yii PHP framework and Twitter Bootstrap.

Yii-Bootstrap is an extension for Yii that provides a wide range of widgets that allow developers to easily use Bootstrap with Yii. All widgets have been developed following Yii's conventions and work seamlessly together with Bootstrap and its jQuery plugins.

Buttons bootstrap.widgets.TbButton

Properties

NameTypeDefaultDescription
buttonTypestringlinkButton callback type. Valid values are link, button, submit, submitLink, reset, ajaxLink, ajaxButton and ajaxSubmit.
typestringButton type. Valid values are primary, info, success, warning, danger, inverse and link.
sizestringButton size. Valid values are large, small and mini
iconstringButton icon, e.g. ok or remove white.
labelstringButton label text.
urlstringButton URL.
encodeLabelbooleantrueWhether the label should be encoded.
blockbooleanfalseWhether the button should span the full width of the a parent.
activebooleanfalseWhether the button is active.
disabledbooleanfalseWhether the button is disabled.
togglebooleanfalseWhether the button can be toggled.
loadingTextstringButton loading text.
completeTextstringButton complete text.
itemsarrayButton dropdown menu items.
htmlOptionsarrayButton HTML attributes.
ajaxOptionsarrayButton AJAX options (used by ajaxLink and ajaxButton).
dropdownOptionsarrayButton dropdown menu HTML attributes.

Button documentation

Examples

Source code
<?php $this->widget('bootstrap.widgets.TbButton', array(
    'label'=>'Primary',
    'type'=>'primary', // null, 'primary', 'info', 'success', 'warning', 'danger' or 'inverse'
    'size'=>'large', // null, 'large', 'small' or 'mini'
)); ?>

Dropdowns

Source code
<div class="btn-toolbar">
    <?php $this->widget('bootstrap.widgets.TbButtonGroup', array(
        'type'=>'primary', // '', 'primary', 'info', 'success', 'warning', 'danger' or 'inverse'
        'buttons'=>array(
            array('label'=>'Action', 'items'=>array(
                array('label'=>'Action', 'url'=>'#'),
                array('label'=>'Another action', 'url'=>'#'),
                array('label'=>'Something else', 'url'=>'#'),
                '---',
                array('label'=>'Separate link', 'url'=>'#'),
            )),
        ),
    )); ?>
</div>

Split dropdowns

Source code
<div class="btn-toolbar">
    <?php $this->widget('bootstrap.widgets.TbButtonGroup', array(
        'type'=>'primary', // '', 'primary', 'info', 'success', 'warning', 'danger' or 'inverse'
        'buttons'=>array(
            array('label'=>'Action', 'url'=>'#'),
            array('items'=>array(
                array('label'=>'Action', 'url'=>'#'),
                array('label'=>'Another action', 'url'=>'#'),
                array('label'=>'Something else', 'url'=>'#'),
                '---',
                array('label'=>'Separate link', 'url'=>'#'),
            )),
        ),
    )); ?>
</div>

Block

Source code
<?php $this->widget('bootstrap.widgets.TbButton', array(
    'type'=>'primary',
    'label'=>'Block level button',
    'block'=>true,
)); ?>

Stateful

Source code
<?php $this->widget('bootstrap.widgets.TbButton', array(
    'buttonType'=>'button',
    'type'=>'primary',
    'label'=>'Click me',
    'loadingText'=>'loading...',
    'htmlOptions'=>array('id'=>'buttonStateful'),
)); ?>
$('#buttonStateful').click(function() {
    var btn = $(this);
    btn.button('loading'); // call the loading function
    setTimeout(function() {
        btn.button('reset'); // call the reset function
    }, 3000);
});

Single state

Source code
<?php $this->widget('bootstrap.widgets.TbButton', array(
    'buttonType'=>'button',
    'type'=>'primary',
    'label'=>'Toggle me',
    'toggle'=>true,
)); ?>
Source code
<?php $this->widget('bootstrap.widgets.TbButtonGroup', array(
    'type' => 'primary',
    'toggle' => 'radio', // 'checkbox' or 'radio'
    'buttons' => array(
        array('label'=>'Left'),
        array('label'=>'Middle'),
        array('label'=>'Right'),
    ),
)); ?>
Back to top ↑

Button groups bootstrap.widgets.TbButtonGroup

Properties

NameTypeDefaultDescription
buttonTypestringlinkSee TbButton::buttonType.
typestringSee TbButton::type.
sizestringSee TbButton::size.
encodeLabelbooleantrueSee TbButton::encodeLabel.
stackedbooleanfalseWhether the button group appears vertically stacked.
togglebooleanfalseSee TbButton::toggle.
dropupbooleanfalseWhether dropdown menus should drop up instead.
buttonsarrayButton configurations.
htmlOptionsarrayButton group HTML attributes.

Button group documentation

Examples

Source code
<?php $this->widget('bootstrap.widgets.TbButtonGroup', array(
    'buttons'=>array(
        array('label'=>'1', 'url'=>'#'),
        array('label'=>'2', 'url'=>'#'),
        array('label'=>'3', 'url'=>'#'),
        array('label'=>'4', 'url'=>'#'),
    ),
)); ?>
Back to top ↑

Breadcrumbs bootstrap.widgets.TbBreadcrumbs

Properties

NameTypeDefaultDescription
separatorstring/Separator between links in the breadcrumbs.

Breadcrumbs documentation

Source code
<?php $this->widget('bootstrap.widgets.TbBreadcrumbs', array(
    'links'=>array('Library'=>'#', 'Data'),
)); ?>
Back to top ↑

Menus bootstrap.widgets.TbMenu

Properties

NameTypeDefaultDescription
typestringMenu type. Valid values are tabs, pills and list.
scrollspystring|arrayScrollspy target or configuration.
stackedbooleanfalseWhether the menu should appear vertically stacked.
dropupbooleanfalseWhether dropdown menus should drop up instead.

Menu documentation

Examples

Basic tabs

Stacked tabs

Basic pills

Stacked pills

Source code
<?php $this->widget('bootstrap.widgets.TbMenu', array(
    'type'=>'tabs', // '', 'tabs', 'pills' (or 'list')
    'stacked'=>false, // whether this is a stacked menu
    'items'=>array(
        array('label'=>'Home', 'url'=>'#', 'active'=>true),
        array('label'=>'Profile', 'url'=>'#'),
        array('label'=>'Messages', 'url'=>'#'),
    ),
)); ?>

Nav list

Source code
<?php $this->widget('bootstrap.widgets.TbMenu', array(
    'type'=>'list',
    'items'=>array(
        array('label'=>'LIST HEADER'),
        array('label'=>'Home', 'icon'=>'home', 'url'=>'#', 'active'=>true),
        array('label'=>'Library', 'icon'=>'book', 'url'=>'#'),
        array('label'=>'Application', 'icon'=>'pencil', 'url'=>'#'),
        array('label'=>'ANOTHER LIST HEADER'),
        array('label'=>'Profile', 'icon'=>'user', 'url'=>'#'),
        array('label'=>'Settings', 'icon'=>'cog', 'url'=>'#'),
        array('label'=>'Help', 'icon'=>'flag', 'url'=>'#'),
    ),
)); ?>
Back to top ↑

Navbar bootstrap.widgets.TbNavbar

Properties

NameTypeDefaultDescription
typestringNavbar type. Set this value to inverse for a dark navbar.
brandstringBrand link text.
brandUrlstringBrand link URL.
brandOptionsarrayBrand link HTML attributes.
fixedstringtopFix location of the navbar. Valid values are top and bottom.
fluidbooleanfalseWhether the navbar should span over the full width of the document.
collapsebooleanfalseWhether the navbar should collapse on narrow screens.
itemsarrayNavigation items.
htmlOptionsarrayNavbar HTML attributes.

Navbar documentation

Examples

Source code
<?php $this->widget('bootstrap.widgets.TbNavbar', array(
    'type'=>'inverse', // null or 'inverse'
    'brand'=>'Project name',
    'brandUrl'=>'#',
    'collapse'=>true, // requires bootstrap-responsive.css
    'items'=>array(
        array(
            'class'=>'bootstrap.widgets.TbMenu',
            'items'=>array(
                array('label'=>'Home', 'url'=>'#', 'active'=>true),
                array('label'=>'Link', 'url'=>'#'),
                array('label'=>'Dropdown', 'url'=>'#', 'items'=>array(
                    array('label'=>'Action', 'url'=>'#'),
                    array('label'=>'Another action', 'url'=>'#'),
                    array('label'=>'Something else here', 'url'=>'#'),
                    '---',
                    array('label'=>'NAV HEADER'),
                    array('label'=>'Separated link', 'url'=>'#'),
                    array('label'=>'One more separated link', 'url'=>'#'),
                )),
            ),
        ),
        '<form class="navbar-search pull-left" action=""><input type="text" class="search-query span2" placeholder="Search"></form>',
        array(
            'class'=>'bootstrap.widgets.TbMenu',
            'htmlOptions'=>array('class'=>'pull-right'),
            'items'=>array(
                array('label'=>'Link', 'url'=>'#'),
                array('label'=>'Dropdown', 'url'=>'#', 'items'=>array(
                    array('label'=>'Action', 'url'=>'#'),
                    array('label'=>'Another action', 'url'=>'#'),
                    array('label'=>'Something else here', 'url'=>'#'),
                    '---',
                    array('label'=>'Separated link', 'url'=>'#'),
                )),
            ),
        ),
    ),
)); ?>
Back to top ↑

Detail views bootstrap.widgets.TbDetailView

Properties

NameTypeDefaultDescription
typearraystriped, condensedGrid types. Valid values are striped, bordered and/or condensed.

Examples

First nameMark
Last nameOtto
LanguageCSS
Source code
<?php $this->widget('bootstrap.widgets.TbDetailView', array(
    'data'=>array('id'=>1, 'firstName'=>'Mark', 'lastName'=>'Otto', 'language'=>'CSS'),
    'attributes'=>array(
        array('name'=>'firstName', 'label'=>'First name'),
        array('name'=>'lastName', 'label'=>'Last name'),
        array('name'=>'language', 'label'=>'Language'),
    ),
)); ?>
Back to top ↑

Grid views bootstrap.widgets.TbGridView

Properties

NameTypeDefaultDescription
typearrayGrid types. Valid values are striped, bordered and/or condensed.

Examples

Default

#First nameLast nameLanguage 
1MarkOttoCSS
2JacobThorntonJavaScript
3StuDentHTML

Striped

#First nameLast nameLanguage 
1MarkOttoCSS
2JacobThorntonJavaScript
3StuDentHTML

Bordered

#First nameLast nameLanguage 
1MarkOttoCSS
2JacobThorntonJavaScript
3StuDentHTML

Condensed

#First nameLast nameLanguage 
1MarkOttoCSS
2JacobThorntonJavaScript
3StuDentHTML

Striped, bordered and condensed

#First nameLast nameLanguage 
 
1MarkOttoCSS
2JacobThorntonJavaScript
3StuDentHTML
Source code
$gridDataProvider = new CArrayDataProvider(array(
    array('id'=>1, 'firstName'=>'Mark', 'lastName'=>'Otto', 'language'=>'CSS'),
    array('id'=>2, 'firstName'=>'Jacob', 'lastName'=>'Thornton', 'language'=>'JavaScript'),
    array('id'=>3, 'firstName'=>'Stu', 'lastName'=>'Dent', 'language'=>'HTML'),
));
<?php $this->widget('bootstrap.widgets.TbGridView', array(
    'type'=>'striped bordered condensed',
    'dataProvider'=>$gridDataProvider,
    'template'=>"{items}",
    'columns'=>array(
        array('name'=>'id', 'header'=>'#'),
        array('name'=>'firstName', 'header'=>'First name'),
        array('name'=>'lastName', 'header'=>'Last name'),
        array('name'=>'language', 'header'=>'Language'),
        array(
            'class'=>'bootstrap.widgets.TbButtonColumn',
            'htmlOptions'=>array('style'=>'width: 50px'),
        ),
    ),
)); ?>
Back to top ↑

Forms bootstrap.widgets.TbActiveForm

Properties

NameTypeDefaultDescription
typestringverticalForm type. Valid values are vertical, inline, horizontal and search.
inlineErrorsbooleanWhether to display errors as blocks.

Form documentation

Examples

Vertical

Source code
<?php /** @var BootActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id'=>'verticalForm',
    'htmlOptions'=>array('class'=>'well'),
)); ?>
 
<?php echo $form->textFieldRow($model, 'textField', array('class'=>'span3')); ?>
<?php echo $form->passwordFieldRow($model, 'password', array('class'=>'span3')); ?>
<?php echo $form->checkboxRow($model, 'checkbox'); ?>
<?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'label'=>'Login')); ?>
 
<?php $this->endWidget(); ?>

Search

Source code
<?php /** @var BootActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id'=>'searchForm',
    'type'=>'search',
    'htmlOptions'=>array('class'=>'well'),
)); ?>
 
<?php echo $form->textFieldRow($model, 'textField', array('class'=>'input-medium', 'prepend'=>'<i class="icon-search"></i>')); ?>
<?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'label'=>'Go')); ?>
 
<?php $this->endWidget(); ?>

Inline

Source code
<?php /** @var BootActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id'=>'inlineForm',
    'type'=>'inline',
    'htmlOptions'=>array('class'=>'well'),
)); ?>
 
<?php echo $form->textFieldRow($model, 'textField', array('class'=>'input-small')); ?>
<?php echo $form->passwordFieldRow($model, 'password', array('class'=>'input-small')); ?>
<?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'label'=>'Log in')); ?>
 
<?php $this->endWidget(); ?>

Horizontal

Legend

In addition to freeform text, any HTML5 text-based input appears like so.

@
.00

Note: Labels surround all the options for much larger click areas.

Source code
<?php /** @var BootActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id'=>'horizontalForm',
    'type'=>'horizontal',
)); ?>
 
<fieldset>
 
    <legend>Legend</legend>
 
    <?php echo $form->textFieldRow($model, 'textField', array('hint'=>'In addition to freeform text, any HTML5 text-based input appears like so.')); ?>
    <?php echo $form->dropDownListRow($model, 'dropdown', array('Something ...', '1', '2', '3', '4', '5')); ?>
    <?php echo $form->dropDownListRow($model, 'multiDropdown', array('1', '2', '3', '4', '5'), array('multiple'=>true)); ?>
    <?php echo $form->fileFieldRow($model, 'fileField'); ?>
    <?php echo $form->textAreaRow($model, 'textarea', array('class'=>'span8', 'rows'=>5)); ?>
    <?php echo $form->uneditableRow($model, 'uneditable'); ?>
    <?php echo $form->textFieldRow($model, 'disabled', array('disabled'=>true)); ?>
    <?php echo $form->textFieldRow($model, 'prepend', array('prepend'=>'@')); ?>
    <?php echo $form->textFieldRow($model, 'append', array('append'=>'.00')); ?>
    <?php echo $form->checkBoxRow($model, 'disabledCheckbox', array('disabled'=>true)); ?>
    <?php echo $form->checkBoxListInlineRow($model, 'inlineCheckboxes', array('1', '2', '3')); ?>
    <?php echo $form->checkBoxListRow($model, 'checkboxes', array(
        'Option one is this and that—be sure to include why it\'s great',
        'Option two can also be checked and included in form results',
        'Option three can—yes, you guessed it—also be checked and included in form results',
    ), array('hint'=>'<strong>Note:</strong> Labels surround all the options for much larger click areas.')); ?>
    <?php echo $form->radioButtonRow($model, 'radioButton'); ?>
    <?php echo $form->radioButtonListRow($model, 'radioButtons', array(
        'Option one is this and that—be sure to include why it\'s great',
        'Option two can is something else and selecting it will deselect option one',
    )); ?>
 
</fieldset>
 
<div class="form-actions">
    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'type'=>'primary', 'label'=>'Submit')); ?>
    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'reset', 'label'=>'Reset')); ?>
</div>
 
<?php $this->endWidget(); ?>

Tabular

English translation

Note: Labels surround all the options for much larger click areas.

Finnish translation

Note: Labels surround all the options for much larger click areas.

Swedish translation

Note: Labels surround all the options for much larger click areas.

Source code
<?php /** @var TbActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id'=>'horizontalForm',
    'type'=>'horizontal',
)); ?>
 
<?php $this->widget('bootstrap.widgets.TbTabs', array(
    'tabs'=>$this->getTabularFormTabs($form, $model),
)); ?>
 
<div class="form-actions">
    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'type'=>'primary', 'label'=>'Submit')); ?>
    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'reset', 'label'=>'Reset')); ?>
</div>
 
<?php $this->endWidget(); ?>
public function getTabularFormTabs($form, $model)
{
    $tabs = array();
    $count = 0;
    foreach (array('en'=>'English', 'fi'=>'Finnish', 'sv'=>'Swedish') as $locale => $language)
    {
        $tabs[] = array(
            'active'=>$count++ === 0,
            'label'=>$language,
            'content'=>$this->renderPartial('_tabular', array('form'=>$form, 'model'=>$model, 'locale'=>$locale, 'language'=>$language), true),
        );
    }
    return $tabs;
}
<fieldset>
 
    <legend><?php echo CHtml::encode($language); ?> translation</legend>
 
    <?php echo $form->textFieldRow($model, "[{$locale}]textField"); ?>
    <?php echo $form->textAreaRow($model, "[{$locale}]textarea", array('class'=>'span8', 'rows'=>8)); ?>
    <?php echo $form->checkBoxListRow($model, "[{$locale}]checkboxes", array(
        'Option one is this and that—be sure to include why it\'s great',
        'Option two can also be checked and included in form results',
        'Option three can—yes, you guessed it—also be checked and included in form results',
    ), array('hint'=>'<strong>Note:</strong> Labels surround all the options for much larger click areas.')); ?>
 
</fieldset>
Back to top ↑

Hero unit bootstrap.widgets.TbHeroUnit

Properties

NameTypeDefaultDescription
headingstringHeading text.
encodeHeadingbooleantrueWhether to encode the heading text.
headingOptionsarrayHeading text HTML attributes.
htmlOptionsarrayHero unit HTML attributes.

Hero unit documentation

Examples

Hello, world!

This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.

Learn more

Source code
<?php $this->beginWidget('bootstrap.widgets.TbHeroUnit', array(
    'heading'=>'Hello, world!',
)); ?>
 
    <p>This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
    <p><?php $this->widget('bootstrap.widgets.TbButton', array(
        'type'=>'primary',
        'size'=>'large',
        'label'=>'Learn more',
    )); ?></p>
 
<?php $this->endWidget(); ?>
Back to top ↑

Thumbnails bootstrap.widgets.TbThumbnails

Thumbnails documentation

Examples

Source code
<?php $this->widget('bootstrap.widgets.TbThumbnails', array(
    'dataProvider'=>$listDataProvider,
    'template'=>"{items}\n{pager}",
    'itemView'=>'_thumb',
)); ?>
<li class="span3">
    <a href="#" class="thumbnail" rel="tooltip" data-title="Tooltip">
        <img src="http://placehold.it/280x180" alt="">
    </a>
</li>
Back to top ↑

Alerts bootstrap.widgets.TbAlert

Properties

NameTypeDefaultDescription
alertsarrayAlerts configurations.
closeTextstring|boolean&times;Close link text. Set to false in order to hide the close link.
blockbooleantrueWhether to display the alerts as blocks.
fadebooleantrueWhether alerts should use transitions.
htmlOptionsarrayContainer HTML attributes.
eventsarrayJavaScript event handlers.

Alert documentation

Examples

×Well done! You successfully read this important alert message.
×Heads up! This alert needs your attention, but it's not super important.
×Warning! Best check yo self, you're not looking too good.
×Oh snap! Change a few things up and try submitting again.
Source code
Yii::app()->user->setFlash('success', '<strong>Well done!</strong> You successfully read this important alert message.');
Yii::app()->user->setFlash('info', '<strong>Heads up!</strong> This alert needs your attention, but it\'s not super important.');
Yii::app()->user->setFlash('warning', '<strong>Warning!</strong> Best check yo self, you\'re not looking too good.');
Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few things up and try submitting again.');
<?php $this->widget('bootstrap.widgets.TbAlert', array(
        'block'=>true, // display a larger alert block?
        'fade'=>true, // use transitions?
        'closeText'=>'&times;', // close link text - if set to false, no close link is displayed
        'alerts'=>array( // configurations per alert type
            'success'=>array('block'=>true, 'fade'=>true, 'closeText'=>'&times;'), // success, info, warning, error or danger
        ),
    ); ?>
Back to top ↑

Progress bars bootstrap.widgets.TbProgress

Properties

NameTypeDefaultDescription
typestringProgress bar type. Valid values are info, success, warning and danger.
stripedbooleanfalseWhether the bar should be striped.
animatedbooleanfalseWhether the bar should be animated.
percentinteger0Progress in percent.
htmlOptionsarrayProgress bar HTML attributes.

Progress bar documentation

Examples

Basic

Striped

Animated

Source code
<?php $this->widget('bootstrap.widgets.TbProgress', array(
    'type'=>'danger', // 'info', 'success' or 'danger'
    'percent'=>40, // the progress
    'striped'=>true,
    'animated'=>true,
)); ?>
Back to top ↑

Labels bootstrap.widgets.TbLabel

Properties

NameTypeDefaultDescription
typestringLabel type. Valid values are success, warning, important, info and inverse.
labelstringLabel text.
encodeLabelbooleantrueWhether to encode the label text.
htmlOptionsarrayLabel HTML attributes.

Label documentation

Examples

Default Success Warning Important Info Inverse

Source code
<?php $this->widget('bootstrap.widgets.TbLabel', array(
    'type'=>'success', // 'success', 'warning', 'important', 'info' or 'inverse'
    'label'=>'Success',
)); ?>
Back to top ↑

Badges bootstrap.widgets.TbBadge

Properties

NameTypeDefaultDescription
typestringBadge type. Valid values are success, warning, important, info and inverse.
labelstringBadge text.
encodeLabelbooleantrueWhether to encode the badge text.
htmlOptionsarrayBadge HTML attributes.

Badge documentation

Examples

1 2 4 6 8 10

Source code
<?php $this->widget('bootstrap.widgets.TbBadge', array(
    'type'=>'success', // 'success', 'warning', 'important', 'info' or 'inverse'
    'label'=>'2',
)); ?>
Back to top ↑

Carousel bootstrap.widgets.TbCarousel

Properties

NameTypeDefaultDescription
prevLabelstring&lsaquo;Previous button text.
nextLabelstring&rsaquo;Next button text.
slidebooleantrueWhether the carousel items should slide.
displayPrevAndNextbooleantrueWhether to display previous and next buttons.
itemsarrayCarousel item configuration.
htmlOptionsarrayCarousel HTML attributes.
optionsarrayJavaScript plugin options.
eventsarrayJavaScript event handlers.

Carousel documentation

Examples

Source code
<?php $this->widget('bootstrap.widgets.TbCarousel', array(
    'items'=>array(
        array('image'=>'http://placehold.it/770x400&text=First+thumbnail', 'label'=>'First Thumbnail label', 'caption'=>'Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.'),
        array('image'=>'http://placehold.it/770x400&text=Second+thumbnail', 'label'=>'Second Thumbnail label', 'caption'=>'Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.'),
        array('image'=>'http://placehold.it/770x400&text=Third+thumbnail', 'label'=>'Third Thumbnail label', 'caption'=>'Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.'),
    ),
)); ?>
Back to top ↑

Modals bootstrap.widgets.TbModal

Properties

NameTypeDefaultDescription
autoOpenbooleanfalseWhether to automatically open the modal.
fadebooleantrueWhether the modal should use transitions.
htmlOptionsarrayModal HTML attributes.
optionsarrayJavaScript plugin options.
eventsarrayJavaScript event handlers.

Modal documentation

Examples

Source code
<?php $this->beginWidget('bootstrap.widgets.TbModal', array('id'=>'myModal')); ?>
 
<div class="modal-header">
    <a class="close" data-dismiss="modal">&times;</a>
    <h4>Modal header</h4>
</div>
 
<div class="modal-body">
    <p>One fine body...</p>
</div>
 
<div class="modal-footer">
    <?php $this->widget('bootstrap.widgets.TbButton', array(
        'type'=>'primary',
        'label'=>'Save changes',
        'url'=>'#',
        'htmlOptions'=>array('data-dismiss'=>'modal'),
    )); ?>
    <?php $this->widget('bootstrap.widgets.TbButton', array(
        'label'=>'Close',
        'url'=>'#',
        'htmlOptions'=>array('data-dismiss'=>'modal'),
    )); ?>
</div>
 
<?php $this->endWidget(); ?>
<?php $this->widget('bootstrap.widgets.TbButton', array(
    'label'=>'Click me',
    'type'=>'primary',
    'htmlOptions'=>array(
        'data-toggle'=>'modal',
        'data-target'=>'#myModal',
    ),
)); ?>
Back to top ↑

Popovers bootstrap.widgets.TbPopover

Popover documentation

Examples

Source code
<?php $this->widget('bootstrap.widgets.TbButton', array(
    'label'=>'Click me',
    'type'=>'danger',
    'htmlOptions'=>array('data-title'=>'A Title', 'data-content'=>'And here\'s some amazing content. It\'s very engaging. right?', 'rel'=>'popover'),
)); ?>
Back to top ↑

Togglable tabs bootstrap.widgets.TbTabs

Properties

NameTypeDefaultDescription
typestringtabsSee TbMenu::type.
placementstringTab placement. Valid values are above, below, left and right.
tabsarrayTabs configuration.
encodeLabelbooleantrueWhether to encode labels.
htmlOptionsarrayTabs HTML attributes.
eventsarrayJavaScript event handlers.

Tabs documentation

Examples

Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.

Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.

Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.

Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.

Source code
<?php $this->widget('bootstrap.widgets.TbTabs', array(
    'type'=>'tabs', // 'tabs' or 'pills'
    'tabs'=>array(
        array('label'=>'Home', 'content'=>'Raw denim you probably haven\'t heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.', 'active'=>true),
        array('label'=>'Profile', 'content'=>'Food truck fixie locavore, accusamus mcsweeney\'s marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.'),
        array('label'=>'Dropdown', 'items'=>array(
            array('label'=>'@fat', 'content'=>'Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney\'s organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven\'t heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.'),
            array('label'=>'@mdo', 'content'=>'Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.'),
        )),
    ),
)); ?>

Tabs on the top

I'm in Section 1.

Howdy, I'm in Section 2.

What up girl, this is Section 3.

Tabs on the left

I'm in Section 1.

Howdy, I'm in Section 2.

What up girl, this is Section 3.

Tabs on the bottom

I'm in Section 1.

Howdy, I'm in Section 2.

What up girl, this is Section 3.

Tabs on the right

I'm in Section 1.

Howdy, I'm in Section 2.

What up girl, this is Section 3.

<?php $this->widget('bootstrap.widgets.TbTabs', array(
    'type'=>'tabs',
    'placement'=>'below', // 'above', 'right', 'below' or 'left'
    'tabs'=>array(
        array('label'=>'Section 1', 'content'=>'<p>I\'m in Section 1.</p>', 'active'=>true),
        array('label'=>'Section 2', 'content'=>'<p>Howdy, I\'m in Section 2.</p>'),
        array('label'=>'Section 3', 'content'=>'<p>What up girl, this is Section 3.</p>'),
    ),
)); ?>
Back to top ↑

Tooltips bootstrap.widgets.TbTooltip

Tooltip documentation

Examples

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce ut velit sem, id elementum elit. Quisque tincidunt magna in quam luctus a ultrices tellus luctus. Pellentesque at tellus urna. Ut congue, nibh eu interdum commodo, ligula urna consequat tortor, at vehicula tellus est a orci. Maecenas nec ligula sed ipsum posuere sollicitudin pretium ac sapien. Sed odio dui, pretium eu pellentesque ac, tempor sed sem.

Source code
<p class="well">
    Lorem ipsum dolor sit <a href="#" rel="tooltip" title="First tooltip">amet</a>,
    consectetur adipiscing elit.
    Fusce ut velit sem, id elementum elit. Quisque tincidunt magna in quam luctus a ultrices tellus luctus.
    Pellentesque at tellus urna.
    Ut congue, <a href="#" rel="tooltip" title="Another tooltip">nibh eu</a> interdum commodo,
    ligula urna consequat tortor, at vehicula tellus est a orci.
    Maecenas nec ligula sed ipsum posuere sollicitudin pretium ac sapien.
    Sed odio dui, pretium eu pellentesque ac,
    <a href="#" rel="tooltip" title="Yet another tooltip">tempor</a> sed sem.
</p>
Back to top ↑

Typeahead bootstrap.widgets.TbTypeahead

Properties

NameTypeDefaultDescription
optionsarrayJavaScript plugin options.

Typeahead documentation

Examples

Source code
<?php $this->widget('bootstrap.widgets.TbTypeahead', array(
    'name'=>'typeahead',
    'options'=>array(
        'source'=>array('Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Dakota', 'North Carolina', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'),
        'items'=>4,
        'matcher'=>"js:function(item) {
            return ~item.toLowerCase().indexOf(this.query.toLowerCase());
        }",
    ),
)); ?>
Back to top ↑

Comments

Back to top ↑