All Projects → caseyWebb → selectr

caseyWebb / selectr

Licence: other
✅ The coolest jQuery select plugin you've never seen

Programming Languages

coffeescript
4710 projects
CSS
56736 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to selectr

Jquery.sumoselect
A jQuery Single/Multi Select plugin which can be used on almost any device
Stars: ✭ 527 (+2673.68%)
Mutual labels:  jquery-plugin, select
Jquery Menu Editor
Multilevel Menu Editor for Bootstrap 4.x (Html & Javascript code)
Stars: ✭ 144 (+657.89%)
Mutual labels:  jquery-plugin, menu
Jquery Selectric
jQuery plugin for easy manipulation and customization of HTML selects
Stars: ✭ 724 (+3710.53%)
Mutual labels:  jquery-plugin, select
menu
基于jQuery的轻量级响应式菜单插件
Stars: ✭ 18 (-5.26%)
Mutual labels:  jquery-plugin, menu
craft-select2
Filter / search a <select> using the popular Select2 fieldtype for Craft CMS
Stars: ✭ 18 (-5.26%)
Mutual labels:  select, select-multiple
Sidr
Sidr is a jQuery plugin for creating side menus and the easiest way for doing your menu responsive.
Stars: ✭ 2,924 (+15289.47%)
Mutual labels:  jquery-plugin, menu
Pretty Dropdowns
A simple, lightweight jQuery plugin to create stylized drop-down menus.
Stars: ✭ 96 (+405.26%)
Mutual labels:  jquery-plugin, select
Teaset
A UI library for react native, provides 20+ pure JS(ES6) components, focusing on content display and action control.
Stars: ✭ 2,845 (+14873.68%)
Mutual labels:  select, menu
Hc Offcanvas Nav
JavaScript library for creating toggled off-canvas multi-level navigations, allowing endless nesting of submenu elements, supporting swipe gestures, keyboard interactions and ARIA attributes.
Stars: ✭ 201 (+957.89%)
Mutual labels:  jquery-plugin, menu
Jquery Ui Contextmenu
jQuery plugin that turns a jQueryUI menu widget into a context menu.
Stars: ✭ 170 (+794.74%)
Mutual labels:  jquery-plugin, menu
hierarchy-select
Hierarchy Select jQuery Plugin for Twitter Bootstrap
Stars: ✭ 40 (+110.53%)
Mutual labels:  jquery-plugin, select
react-native-select-pro
React Native dropdown (select) component developed by Mobile Reality
Stars: ✭ 79 (+315.79%)
Mutual labels:  select, menu
ml-stack-nav
Customizable, responsive, accessible, easy-to-use multi-level stack navigation menu with slide effect.
Stars: ✭ 20 (+5.26%)
Mutual labels:  jquery-plugin, menu
Selectmenu
Simple, easily and diversity menu solution
Stars: ✭ 284 (+1394.74%)
Mutual labels:  jquery-plugin, menu
lazeemenu
Multi-level sidebar menu - JQuery plugin
Stars: ✭ 40 (+110.53%)
Mutual labels:  jquery-plugin, menu
Selectivity
Modular and light-weight selection library
Stars: ✭ 1,113 (+5757.89%)
Mutual labels:  jquery-plugin, select
React Dropdown Select
Customisable dropdown select for react
Stars: ✭ 227 (+1094.74%)
Mutual labels:  select, menu
React Native Dropdown Picker
A single / multiple, categorizable & searchable item picker (dropdown) component for react native which supports both Android & iOS.
Stars: ✭ 230 (+1110.53%)
Mutual labels:  select, menu
Metismenu
Related projects
Stars: ✭ 1,904 (+9921.05%)
Mutual labels:  jquery-plugin, menu
flutter-package-selection menu
A flutter widget, highly customizable, to select an item from a list of items.
Stars: ✭ 32 (+68.42%)
Mutual labels:  select, menu

NOTE: This package is unmaintained, but I'll do my best to tend to any PRs that are submitted. Why? I've found it much easier to implement the same thing natively with whichever framework/library I'm using (Knockout, Angular, etc.).

Selectr

Selectr is a jQuery plugin that aims to accomplish a seemingly simple task: make a select box that doesn't suck.

It currently supports ctrl+click, search, color-coding, and selection limiting (multi-selects). In modern browsers (Chrome, Safari, FF, IE11), selectr ensures your source element's options and itself remain in sync. If you require this behavior (e.g. because you're using a data-binding framework of some sort) in legacy IE, see Legacy Browser Caveats below.

It is built using Bootstrap components, and is written in CoffeeScript and SCSS; if your project is not using Bootstrap, you should use selectrWithPolyfill.css -- which includes all of selectr's styles along with the relevant Bootstrap styles (scoped to avoid conflicting with existing styles, of course) -- or write your own styles.

Selectr was heavily inspired by select2 and the label/assignee/milestone dropdowns in Github's issue tracker.

Click here to view demo

Installation

Selectr can be consumed as a CommonJS module, AMD module, or global var. It is built with webpack and uses the style loader, so you do not need to worry about including a stylesheet.

NOTE: CommonJS and AMD modules still merely extend jQuery, so this will not work

var selectr = require('selectr')

selectr('#my-selectr')

you must instead use the following

require('selectr')
$ = require('jquery')

$.selectr('#my-selectr')

NPM / Bower

npm install selectr

bower install selectr

Usage

To use selectr, simply fire it using jQuery

$('select').selectr()

Multi selects

To make selectr a multi select, simply use the multiple attribute on your select element as you would with regular HTML.

<select name="foo" multiple>

Color coding

Selectr supports color coding of options by setting the data-selectr-color attribute on the option. Any valid CSS color is supported, i.e. hex, rgba(a), hsl(a).

Ex.

<option data-selectr-color="rgb(255, 255, 255)" value="foo">Foo</option>

Options and defaults

title:                  'Select Options'
noMatchingOptionsText:  'No options found'
placeholder:            'Search'
resetText:              'Clear All'
width:                  '300px'
maxListHeight:          '250px'
tooltipBreakpoint:      25 # min length of option name to show tooltip on
maxSelection:           Infinity
panelStyle:				'default'
alwaysShowFooter:		false

To pass options to selectr, you may use an HTML5 data-* attribute, or an options object passed to the initialization function.

Using HTML5 data attributes

<select name="foo" data-selectr-opts='{ "title": "Foo Bar", "placeholder": "Bax Qux", "maxSelection": 5, ... }' multiple>

NOTE: Attribute must be valid JSON; that means quoted keys as well as values. This is to avoid using eval().

But wait! I need quotes/apostrophes in my title! Easy fix. Use the ASCII code, i.e. instead of ' use &#39; and instead of " use &quot;.

Using an options object

$('select').selectr({ title: 'Foo Bar', placeholder: 'Baz Qux', ... });

NOTE: Order of precedence

HTML5 data attributes take precedence over the options object. This allows you to pass certain parameters that should apply to most/all selectr instances, and "fill in the blanks" or override those options with the data-selectr-opts attribute. See demo file for an example.

Compatiblity

Requires jQuery 1.8.3+

Tested in the following browsers:

  • Chrome
  • Firefox
  • IE 8+*

*Legacy Browser (IE8-10) caveats

selectr uses MutationObservers to update the list of options, which are unsupported by older browsers. Instead of hacking together a buggy solution, I've opted to require that, in order to sync the options list in older browsers, a change event be manually fired on the source select element when the options change.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].