0

It seems Bootstrap is becoming more and more popular lately, giving a consistent feel for responsive dialogs and forms. Is it generally best practice, for now and the future, to use Bootstrap, or jQuery-UI for things like dialogs, tabs, forms, etc.?

From what I've seen they both may have advantages:

For Bootstrap:

  • It's a newer library, not as likely to interfere with some plugin's included jQuery-ui-css from 5 versions ago of jQuery-ui that is no longer supported. (Unfortunately it can conflict with jQuery-ui, requiring workarounds).

  • The nature of Bootstrap makes Javascript code less necessary for simple stuff. (Dialogs can be opened from a button with an attribute target for example).

For jQuery-UI:

  • Has been standard part of WP for some time. (Unfortunately, changes its version from version to version in Wordpress.)
  • Easy positioning and JS-centric api (position my top right at top + 100px is easy), modal y/n is a setting in initialization, along with many others.
  • Resizable dialogs, jQuery-ui draggable, etc.

Obviously both of these libraries are widely used, but which is generally considered best-practice in WP? Any thoughts?

  • Use what you want, what you like more, what is easier for you to use, don't use any if you want and develop your own .... or whatever other reason you may have. Questions which have opinion based answers, like your question, is off-topic in this site. Asking for recommend a particular third party product is also off-topic. – cybmeta Sep 13 '14 at 12:04
1

There are roughly following factors to consider:

  1. Does it ship with WP core
  2. How easy it is to integrate with WP
  3. How easy it is to use in public WP extension

Let's go over these for both.

Bootstrap

Bootstrap doesn't ship with WordPress core, so your implementation will need to provide it.

While markup of the Bootstrap is rather pleasant by itself, it requires degree of customization, which many parts of WordPress are horrible at. Typically in WordPress development you start with markup that WP gives you and go from there. Starting with external idea of markup and aligning WP output to it is always an extra level of challenge.

Extreme popularity of Bootstrap makes it likely to encounter multiple copies of its styles and/or scripts when using public extensions. So far there hadn't been enough attention paid to it by developers. Properly shipping Bootstrap or parts of it in code for distribution requires carefully scoping them to your functionality. Again — extra level of development challenge.

jQuery UI

jQuery UI ships with WordPress core, which makes it easy to share and unnecessary to ship.

It is interesting to note, however, that it seems to be quite underused in actual development. WordPress has historically been PHP–centric. Despite quite forceful push for JS–driven functionality, JS still has bit of an under-known (and a lot of horribly undocumented) aspect to it in WP development.

Overall

There is no clear winner here. Both dependencies have their own implementation challenges and while jQuery UI wins in bundling it loses (in my perception) in popularity and ecosystem (Bootstrap has grown not just itself, but wide array of third party extensions and solutions, depending on it).

Personally I use Bootstrap, but my extensions are mostly personal and/or quite niche.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.