Yii 1.1: bootstrap

Yii-Bootstrap - Bringing together Yii and Twitter Bootstrap

This extension brings together Yii and Bootstrap, Twitter's HTML, CSS and JavaScript toolkit. It provides a wide range of widgets that allow you 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.

Note before upgrading to 2.0.x

Bootstrap should no longer be preloaded, instead you should define a path alias, bootstrap, in your application configuration (an example can be found here).



Do you want to say thanks for the time and efforts put on this project?

Donate with PayPal


Yii 1.1.10 or above (Bootstrap requires jQuery 1.7.1 or newer).


Installation instructions can be found here: Yii-Bootstrap home.

What's included?

Bootstrap contains the following widgets:

  • TbAffix - Affix wrapper
  • TbActiveForm - ActiveForm
  • TbAlert - Flash messages
  • TbBadge - Badges
  • TbBreadcrumbs - Breadcrumbs
  • TbButton - Buttons
  • TbButtonGroup - Button groups
  • TbCarousel - Image carousel
  • TbCollapse - Collapse wrapper
  • TbDetailView - Detail view
  • TbGridView - Grid view
  • TbHeroUnit - Page head
  • TbLabel - Labels
  • TbListView - List view
  • TbMenu - Menu
  • TbModal - Modal dialog
  • TbNavbar - Navigation bar
  • TbPager - Pager
  • TbProgress - Progress bars
  • TbScrollSpy - Scrollspy wrapper
  • TbTabs - JavaScript tabs
  • TbThumbnails - Image grid
  • TbTypeahead - Autocomplete


Version 2.1.0 (March 17, 2013)

  • Upgrade to Bootstrap 2.3.1

Version 2.0.3 (Jan 1, 2013)

  • Fixed less import issue

Version 2.0.2 (Dec 22, 2012)

  • Fixed some bugs

Version 2.0.1 (Dec 19, 2012)

  • Fixed some old bugs

Version 2.0.0 (Dec 19, 2012)

  • Upgraded to Bootstrap 2.2.2
  • Added support for form builder
  • Added Bootstrap base theme
  • Added affix widget
  • Restructured assets and remove lib
  • Changed the way some plugins are registered
  • A lot of other minor improvements

Version 1.2.0 (Nov 1, 2012)

  • Upgraded to Bootstrap 2.2.1

Version 1.1.0 (Sep 20, 2012)

  • Upgraded to Bootstrap 2.1.1

Version 1.0.0 (Aug 22, 2012)

  • Upgraded Bootstrap to 2.1.0
  • Changed class prefix to Tb
  • Added collapse and scrollspy widgets
  • Rewrote the alert widget
  • Rewrote menus to extend CMenu
  • Renamed tabbable to tabs
  • Improved the active form widget
  • Added for the nested menu items
  • Added support for dropups
  • Numerous other minor improvements
  • Fixed a huge bunch of bugs
  • Completely reworked the demo

Version 0.10.0 BETA (May 13, 2012)

  • Major improvements to BootActiveForm and BootInput
  • Changed BootGridView and BootListView to automatically rebind popovers and tooltips
  • Fixed vertical form validation styles (#30)
  • Fixed BootCarousel binding (#78)
  • Fixed BootBreadcrumbs homeLink

Version 0.9.12 (Apr 25, 2012)

  • Upgraded to Bootstrap 2.0.3
  • Changed to use bootstrap.min.js instead of separate files
  • Fixed BootModal JavaScript options
  • Fixed Bootstrap Gii templates (#66)
  • Added support for add-ons on password fields (#64)
  • Fixed disabling of BootBreadcrumbs homeLink (#61)
  • Fixed BootNavbar static positioning (#60)
  • Fixed BootActiveForm textfield validation (#54)
  • Fixed resolving of BootInput checkbox and radio attributes (#52)

Version 0.9.11 (Apr 14, 2012)

  • Added BootLabel, BootBadge
  • BootTabbable improvements
  • BootButton, BootButtonGroup improvements
  • BootNavbar, BootMenu improvements
  • BootGridView, BootDetailView improvements
  • Fixed BootTabbable events
  • Added missing CSS for Yii components
  • Renamed BootButton::fn to buttonType

Version 0.9.10 (Mar 13, 2012)

  • Upgraded to Bootstrap 2.0.2
  • Added BootHero, BootCarousel, BootProgress, BootTypeahead
  • BootButton and BootButtonGroup improvements
  • BootBaseMenu, BootMenu, BootDropdown improvements
  • Renamed BootCrumb to BootBreadcrumbs
  • Renamed BootThumbs to BootThumbnails

Version 0.9.9 (Feb 17, 2012)

  • Upgraded to Bootstrap 2.0.1
  • Integrated Bootstrap's native jQuery plugins
  • Plugin API
  • Renamed BootNav to BootNavbar
  • Renamed BootTabs to BootTabbed
  • Renamed BootTwipsy to BootTooltip
  • Renamed BootMediaGrid to BootThumbs

Version 0.9.7 (Dec 24, 2011)

  • Added BootNav (Topbar navigation)
  • Added support for dropdown menus in BootMenu (and BootNav)
  • Fixed import paths

Version 0.9.6 (Dec 16, 2011)

  • Added BootTabs (JavaScript tabs)
  • Fixed an issue with sorting in BootGridView
  • Fixed the order hint and error are rendered by BootInput
  • Changed the script files and scripts to be registered correctly
  • Corrected the close text for BootAlert

Version 0.9.5 (Dec 2, 2011)

  • Fixed a bug in the Bootstrap Gii generator
  • Added support for input lists
  • Combined BootTabs and BootPills to BootMenu
  • Moved all widgets under the same folder
  • Removed BootHtml
  • Renamed BootInputBlock to BootInput
  • Renamed the block methods in BootActiveForm to row

Version 0.9.4 (Nov 14, 2011)

  • Updated to Bootstrap 1.4.0

Version 0.9.3 (Oct 23, 2011)

  • Added BootModal, BootTabs, BootPills
  • Renamed BootFlash to BootAlert
  • Replaced the jQuery plugins with completely new jQuery UI widgets
  • Added support rendering of captcha rows

Version 0.9.2 (Oct 21, 2011)

  • Added BootPopover (rich content tooltip widget)
  • Fixed a few bugs in the BootCrumb widget
  • Improved the jQuery plugins

Version 0.9.1 (Oct 3, 2011)

  • Added BootFlash (flash message widget)
  • Added BootstrapGenerator (Gii CRUD templates)
  • Various improvements to BootActiveForm

Version 0.9.0 (Sep 26, 2011)

  • Initial public release

Total 20 comments

#17721 report it
Rohit Suthar at 2014/07/17 07:58am
Thanks mam

Thank You! very much for your patience and sharing the code.

#17592 report it
nakovn at 2014/07/07 12:21am
Bootstrap and Rights Module

Hello! In my project, i'm using this extension and rights modules. But in rights, bootstrap wasn't load. What should i do?

#16955 report it
sirin k at 2014/04/16 05:48am
is this upgraded to bootstrap 3.0?

is this upgraded to bootstrap 3.0?

#16737 report it
jcagentzero at 2014/03/23 11:49pm
Thank You

Many thanks for the hardwork!

#16368 report it
JustinV at 2014/02/15 09:00am
HTML5 form Elements - Email and URL

If anyone wants to add the email and url elements that are part of HTML5 here is a quick qay to do so: Add support for rendering email and url fields

#15234 report it
heal at 2013/10/20 08:25am
Render form from config

Hello, Can someone tell me, how can I create and render the form from config, like this?

$form = new CForm("path.to.get.form.configuration", $model);
#14798 report it
Xindexer at 2013/09/10 09:04am
Bootstrap 3

So there isn't a ton of difference between the latest version and the one I wrote. If you download the code and run the demo project, you will see that I annotated any differences between the old set up and the new one with Bootstrap 3.

Over 90% of the functions are the same. I did everything in the background where I could. There are some differences in some of the functions but you should be able to see what needs to be done in the Demo.

As soon as I finished upgrading this code, I saw that Chris moved on to yiistrap. After looking at what he is doing there, I decided to upgrade that script as well. It really is a much better version than this one, so if you are just starting out, I would recommend that you use the new version.


#14794 report it
Trần Minh Quang at 2013/09/10 05:26am
Me too :)

@Xindexer: So What about updating this extension article with the new version? any new tutorial? change logs and so on...

Me too

#14769 report it
Shahcheraghean at 2013/09/09 12:52am
Bootstrap 3 really needed

@Xindexer Thank you so much. It was really needed. So What about updating this extension article with the new version? any new tutorial? change logs and so on...

#14768 report it
Xindexer at 2013/09/08 04:16pm
Bootstrap 3.0

I have updated this code to work with Bootstrap 3. It still needs some work but it's pretty close.


the code is under the "bootstrap 3" branch.

there are notes in the demo folder to help you see what I did.

#14682 report it
Shahcheraghean at 2013/09/03 08:55am
Very Bad News

It is too bad news that this extension is not supported so longer. I`m so sorry for it!

#14635 report it
sensorario at 2013/08/30 11:13pm
Your is no HTML

You cannot put a tag inside an attribute of another tag. To have a tooltip, you need a jquery plugin like this one: http://jqueryui.com/tooltip/#custom-content

#14633 report it
Muhammad Shahzad at 2013/08/30 07:33pm

I want to show image thumbnail in tooltip,I tried this code but not success,please anyone tell me how to show image in bootstrap tooltip? my code is like this:

<a rel="tooltip"  title="<img src='https://si0.twimg.com/a/1339639284/images/three_circles/twitter-bird-white-on-blue.png' />"  href="#">Yii Themes</a>
#14548 report it
realtebo at 2013/08/22 05:53am
Do you wanna a tip?

Migrate to YYiStrap ! It's a totally new generation extension ...

Even YiiStrap has Boostrap 2.3.2, but you must actually accept the fact that bootstrap 3 is REALLY A LOT different from BS2, so it's improbable that someone can MIGRATE an extension that heavily uses it. The code of the extension must be rewritten a lot !

#14547 report it
Trần Minh Quang at 2013/08/22 05:33am
Bootstrap 3

Waitting for update this extension with bootstrap 3 :)

#14233 report it
rooney10 at 2013/07/29 05:41am
Bootstrap 3 RC1

Will there be an update of the extension to Bootstrap 3 RC1? Thx in advance :)

#13977 report it
karte at 2013/07/10 09:13am
Alias "bootstrap.widgets.TbHeroUnit" is invalid

Alias "bootstrap.widgets.TbHeroUnit" is invalid. Make sure it points to an existing PHP file and the file is readable. can anyone pls help me out... something error in path, I cant figure it out

#13923 report it
nmaybar at 2013/07/06 07:57am
yii-bootstrap generator is not working

have followed below instructions to set main.config (the same instruction mentioned in extenstion setup) // Define a path alias for the Bootstrap extension as it's used internally. // In this example we assume that you unzipped the extension under protected/extensions. Yii::setPathOfAlias('bootstrap', dirname(FILE).'/../extensions/bootstrap');

return array( 'theme'=>'bootstrap', // requires you to copy the theme under your themes directory 'modules'=>array( 'gii'=>array( 'generatorPaths'=>array( 'bootstrap.gii', ), ), ), 'components'=>array( 'bootstrap'=>array( 'class'=>'bootstrap.components.Bootstrap', ), ), );

but when i try to open gii I get the following error:

Alias "gii.GiiModule" is invalid. Make sure it points to an existing PHP file and the file is readable.

I noticed that the provided configuration instruction do not contain the following text in gii module array in the main.config file

'modules' => array( 'gii' => array( ** 'class' => 'system.gii.GiiModule', 'password' => 'gii',** ) ) which caused the problem of error above. so I updated my main.config to be like below:

'modules' => array(
    'gii' => array(
        'class' => 'system.gii.GiiModule',
        'password' => 'gii',
        // If removed, Gii defaults to localhost only. Edit carefully to taste.
        'ipFilters' => array('', '::1'),
        'generatorPaths' => array(

the gii module worked fin and i can generate models,views,controller and so on but they are not generated with bootstrap widgets. so how can i use yii-bootstrap and gii to generate views with bootstrap widgets ? Thanks in advanced.

#13856 report it
Stepan Selyuk at 2013/07/02 07:20am
Wrong constant

Hello, you need to use


instead of FILE.

and check your

dirname( __FILE__ )


#13854 report it
mayur2111 at 2013/07/02 06:33am
problem to install bootstrap


when i use Yii::setPathOfAlias('bootstrap', dirname(FILE).'/../extensions/bootstrap'), this code in config/main.php this time on CExceptions generated like:

       Property "CWebApplication.0" is not defined

please give me solution for this Exception.. replay me as soon as you can.

thank u.

Leave a comment

Please to leave your comment.

Create extension