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
    Write Simple, Elegant and Maintainable Media Queries with Sass

    I spent a few months experimenting with different approaches for writing simple, elegant and maintainable media queries with Sass. Each solution had something that I really liked, but I couldn't find one that covered everything I needed to do, so I ventured into creating my...

  • By
    CSS Filters

    CSS filter support recently landed within WebKit nightlies. CSS filters provide a method for modifying the rendering of a basic DOM element, image, or video. CSS filters allow for blurring, warping, and modifying the color intensity of elements. Let's have...

Incredible Demos

  • By
    Use Custom Missing Image Graphics Using MooTools

    Missing images on your website can make you or your business look completely amateur. Unfortunately sometimes an image gets deleted or corrupted without your knowledge. You'd agree with me that IE's default "red x" icon looks awful, so why not use your own missing image graphic? The MooTools JavaScript Note that...

  • By
    Jack Rugile’s Favorite CodePen Demos

    CodePen is an amazing source of inspiration for code and design. I am blown away every day by the demos users create. As you'll see below, I have an affinity toward things that move. It was difficult to narrow down my favorites, but here they are!

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!