JavaScript MIT

nice-select2

A lightweight vanilla javascript library that replaces native select elements with customizable dropdowns

B

bluzky

Dernière activité 25 sept. 2026
bluzky/nice-select2

408

étoiles

62

forks

1

issues ouvertes

nice-selectnice-select2selectselect2vanilla-javascript

Ce README est souvent en anglais.

Nice Select

A lightweight Vanilla JavaScript plugin that replaces native select elements with customizable dropdowns.

Install

npm i nice-select2

Usage

Include nice-select2 script.

<script src="path/to/nice-select2.js"></script>

Include the styles, either the compiled CSS...

<link rel="stylesheet" href="path/to/nice-select2.css" />

Or import nice-select2 using ES6 syntax

import NiceSelect from "nice-select2";
@import "~nice-select2/dist/css/nice-select2.css";
// or
@import "~nice-select2/src/scss/nice-select2.scss";

Finally, initialize the plugin.

Using the minimified file directly:

NiceSelect.bind(document.getElementById("a-select"), {searchable: true, placeholder: 'select', searchtext: 'zoek', selectedtext: 'geselecteerd'});

Using as import in webpack:

new NiceSelect(document.getElementById("a-select"), {searchable: true});

Instance method

  • update() : update nice-select items to match with source select
  • focus(): open dropdown list and focus on the search box if search is enabled
  • disable(): disable select
  • enable(): enable select
  • destroy(): destroy NiceSelect2 instance
  • clear(): clear all selected options

Full documentation and examples at https://bluzky.github.io/nice-select2/.

Projets similaires

A vanilla JS customisable select box/text input plugin ⚡️

JavaScriptchoicechoiceschoicesjs
CChoices-js
6,8 k étoiles632

Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.

JavaScripthacktoberfestjavascriptjquery
Sselect2
25,9 k étoiles6,1 k

Tom Select is a lightweight (~16kb gzipped) hybrid of a textbox and select box. Forked from selectize.js to provide a framework agnostic autocomplete widget with native-feeling keyboard navigation. Useful for tagging, contact lists, etc.

JavaScriptchoicechoicesdropdown
Oorchidjs
2,2 k étoiles174