Elegant Selects with Quick[select]

By  on  

Form elements have always allowed limited styling...which is why I hate working on form display.  And I started when form elements were virtually unstylable back in the Internet Explorer 4 days.  Of course we've come a long way but there's one element which is still somewhat difficult to style and isn't particularly elegant:  SELECT.  The element looks different from OS to OS and sometimes even browser to browser -- not ideal.

I recently found an awesome jQuery plugin to make the SELECT element more presentable, elegant, and stylable:  Quick[select].  Quick[select] turns SELECT options into clickable buttons with a traditional SELECT as a fallback.

The CSS

Quick[select] comes with a base stylesheet but you can style the option "buttons" in any way you'd like, as you can see in my demo.  Here are my basic styles:

.btn-group .btn {
	border: 1px solid #ccc;
	background: #eee;
	padding: 4px;
	border-radius: 4px;
	margin: 0 10px 0 0;
	font-size: 14px;
	display: inline;

	transition: background .3s, border-color .3s;
}
.btn-group .btn.active {
	background: #7ac9ed;
	border-color: #0c7bb6;
}

Quick[select] also has a helper for bootstrapped-driven sites, if that's your stack.

The JavaScript

Using Quick[select] is easy:  add the plugin to the page and then use the jQuery plugin syntax to create instances for given SELECT elements:

jQuery('#wakeup-time').quickselect({
	activeButtonClass: 'btn-primary active',
	breakOutValues: ['06:30', '07:00', '07:30', '08:00'],
	buttonClass: 'btn btn-default',
	selectDefaultText: 'Other',
	wrapperClass: 'btn-group'
});

The most important option is breakOutValues which generates clickable buttons for popular choices (specified by you) within the SELECT element.  You'll also want to set a custom selectDefaultText value for when the button which triggers the full display of the options.

Quick[select] is the best SELECT alternative that I've seen in a long time.  This plugin allows for elegant, stylish, and usable SELECT elements.  Go check it out and do your users a favor!

Recent Features

  • By
    How I Stopped WordPress Comment Spam

    I love almost every part of being a tech blogger:  learning, preaching, bantering, researching.  The one part about blogging that I absolutely loathe:  dealing with SPAM comments.  For the past two years, my blog has registered 8,000+ SPAM comments per day.  PER DAY.  Bloating my database...

  • By
    Welcome to My New Office

    My first professional web development was at a small print shop where I sat in a windowless cubical all day. I suffered that boxed in environment for almost five years before I was able to find a remote job where I worked from home. The first...

Incredible Demos

  • By
    Fixing sIFR Printing with CSS and MooTools

    While I'm not a huge sIFR advocate I can understand its allure. A customer recently asked us to implement sIFR on their website but I ran into a problem: the sIFR headings wouldn't print because they were Flash objects. Here's how to fix...

  • By
    Retrieve Google Analytics Visits and PageViews with PHP

    Google Analytics is an outstanding website analytics tool that gives you way more information about your website than you probably need. Better to get more than you want than not enough, right? Anyways I check my website statistics more often than I should and...

Discussion

  1. Hi David. Thanks for highlighting my plugin!

  2. MaxArt

    This is a nice alternative way to display multiple options, but if a classic combo is needed I’d rely on the CSS appearance property, and fall back to the unstyled element for those browsers that don’t support it (hint: you can even use @supports in this case).

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!