[Extension] Yiistrap

Hey All,

Yiistrap, the new version of the popular Yii-Bootstrap extension is finally here.

If you liked Yii-Bootstrap you will love Yiistrap.

You can download it from extensions or clone it from GitHub:

  • Yiistrap docs

  • Yiistrap in extensions

  • Yiistrap on GitHub

Feel free to leave your thoughts below.

Great! Thank you very much Chris.

nice, thanks.

but when i want to use it as an extension on my app and set config file(alias and components) yii cant realize the extension and send this error:

include(TbHtml.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory

any suggestion?

Hey onikandish,

You have to import bootstrap.helpers.TbHtml in your application configuration.

EDIT: I added this to the docs because it seems that we forgot it. Thanks for pointing this out.

OK thanks i will try it.

just one more question:

should i add the bootstrap files(css,js) to my layout manually?

because html code works well but these files not included.

thank you again for your response.

Hey again onikandish,

The easiest way to register the client scripts is to call the following method in your main layout:


That method will register all necessary CSS and JavaScript -files for you.

EDIT: I’ve added this to the docs now as well.

Hi Chris,

I am a big fan of all of your work, and I was using bootstrap with LESS the other day, and realized that maybe it would be a good thing to maybe have the call to register() be configurable to either call only js or only css, as since I was using LESS I didn’t need to re-register the css.

Just a thought.

Thanks tons for your very generous work!

Hey deez,

register is not the only method available, there is also registerCoreCss, registerResponsiveCss, registerAllCss, registerCoreScripts, registerTooltipAndPopover and registerAllScripts. Take your pick (I usually only call registerAllScripts).


First of all, thank you so much for providing the new version of Yii-Bootstrap, which looks very nice IMHO. B)

I have been replacing old Bootstrap components in my application with Yiistrap, but there are some questions that I would like to ask:

  1. When using textFieldControlGroup for required field, I didn’t see ‘’ mark (asterisk) beside textfield label. How do you add that '’ mark? I tried to use normal textFieldRow, but got an error: ‘TbActiveForm and its behaviors do not have a method or closure named “textFieldRow”.’

  2. I couldn’t find TbDetailView and Captcha textfield in Yiistrap. Have they been available now? Or do you intend to remove them in this new version?

  3. In TbGridView sample page, the type for TbGridView with Hover style is TbHtml::GRID_HOVER. I guess that should be TbHtml::GRID_TYPE_HOVER?

  4. After replacing old TbGridView, I found the new grid looked a bit strange (please see the attached picture). Sort arrows (which should only be displayed in one column header) appear in every column. Also, the summary text is displayed below grid. The code I use:

$this->widget('bootstrap.widgets.TbGridView', array(




















Am I doing anything wrong here?

Hey rei,

  1. In Yiistrap we use activeLabel instead of activeLabelEx at least for now because Bootstrap itself includes no styles for the required asterix. I guess we could make this configurable if there is a big demand for it.

  2. Neither of those are a part of Yiistrap, TbDetailView is included in Yiiwheels but it’s still under development. As for the captcha, you can wrap it yourself, take a look at TbHtml::customControlGroup and TbHtml::customActiveControlGroup.

  3. That’s a typo.

  4. I cannot seem to find this image.

Thanks for your super fast reply. :) Here I attach the image again. Can you see it? 4409

Yiistrap grid.png

Hey again rei,

I see the issue. I didn’t think we needed the additional css for yii but now I’m starting to change my mind. I’ll see what I can do to fix this.

This has now been fixed, please update to the latest version.

Hi Chris,

Great! Appreciate your quick fix. The grid’s sort arrow only appears in 1 column now, but I saw 2 possible issues there:

  1. When column is sorted in ascending order, the arrow image (caret) that appears is reverse triangle, whereas normal CGridView uses triangle for ascending sort (please see the attached picture). I remember similar issue in Yii-Bootstrap.

  2. Summary text of TbGridView (‘Displaying … of … results’ text) always appears on the bottom (not exactly on the right side of grid, but near the center). I tried to set template property:



   'template'=>'{summary} {items} {pager}',


but that made the summary text didn’t use the same styles as the other text in grid (I need to apply additional CSS class).

Are those the expected behaviour of TbGridView? If we want to place summary text on the top of grid, should we set ‘template’ property every time we use TbGridView?

By the way, when trying Bootstrap Generator (via Gii) today, I got this error:

BootstrapCode and its behaviors do not have a method or closure named "generateActiveRow". (/.../protected/extensions/bootstrap/gii/bootstrap/templates/default/_search.php(26))

Is the generator still in development process?

Hey rei,

I’ve fixed the typo in the gii template and I’ll take a look at styling the sort, summary, etc. later.

EDIT: The grid view styles are now also fixed.

Bootstrap generator doesn’t raise error anymore, but there are file parsing errors in the generated view files. I guess that’s caused by additional PHP tag at the beginning of files:


/* @var $this CategoryController */

/* @var $model Category */

Also, as you mentioned that TbDetailView was not a part of Yiistrap, why does bootstrap generator still use it when generating ‘view’ file?







The sort arrow looks nice now. :) However, the summary text is still displayed at the bottom of grid (as shown in the attached picture). Did you really intend to set it as the default setting of TbGridView?

Hello Chris!

I’m trying to swich a project from yii-bootstrap, and have some troubles\questions.

  1. TbNav (type is set to tabs) raise a warning if dropdown item has an url property.

<?php $this->widget('bootstrap.widgets.TbNav', array(

      'type' => 'tabs',

      'items' => array(

        array('label' => 'tab1', 'url' => array('my/action1')),

        array('label' => 'tab2', 'url' => array('my/action2')),

        array('label' => 'dropdown', 'url' => array('my/showSubActions'), 'items' => $items),


If I remove url from last item it works fine. In old yii-bootstap all works fine.


  1. TbDetailView.

I use it everywhere in project and temporary I’ve got it entirely from YiiWheel as you mentioned before. Will it be changed completely, and how soon can we expect it?

2.1. Some styles are wrong - titles and fields are not aligned each to other (see “old” and “new” screenshots), although i’ve added .detail-view styles to yiistrap.css.

2.2. I see, in wheels’ widget elements count have moved down the list. But it layouts on separate lines (see screenshot). Wouldn’t it be nice to place it on the same line?

  1. Suggestion to switch off a responsive desing by adding a couple parameters: https://github.com/Crisu83/yiistrap/issues/46

  2. checkBoxListControlGroup uncheckValue - option for hidden element: ‘null’ - doesn’t work.


I’m developing a new Yii application and I decided to use Yiistrap + Yiiwheels. In the past I used both Yii Bootstrap and YiiBooster and I was satisfied with them.

To be honest I preferred the way those were working (simpler API for me, the method names were better IMO) but if I understand it correctly Yiistrap is going to be faster and more lightweight.

As Yiiwheels doesn’t have a topic here let me ask you whether you know any release date of it? I want to use the fileupload widget included there but it has many errors at the moment.

About Yiistrap, do I understand it correctly that when Bootstrap 3 will be released you’re going to release a new extension for it? So if I start using Yiistrap now and if Bootstrap 3 is released next week then will I have to rewrite my code to use that?

PS: thank you for your great work!

Hi Cris,

Any documented difference between this and YiiBooster?

Does it include gallery widget?