Replace a plain HTML select element with a searchable, multi-select tag input that users can type to filter options.
Add a dropdown where users can type in custom values not already in the predefined list.
Style a select box consistently across all browsers by replacing the native element with a Choices.js widget.
Programmatically add, remove, or clear dropdown options in response to other user interactions on the page.
Choices.js is a JavaScript library that upgrades the default dropdown select boxes and text input fields that browsers provide. The standard HTML select element is limited: it looks different on every browser, cannot be styled easily, and has no built-in search. Choices.js replaces it with a custom-rendered widget that looks consistent, supports filtering by typing, and adds features like multi-select with removable tags, the ability to let users add their own options, and full control over the visual appearance through CSS. The library works without jQuery or any other framework, which keeps it small (around 20 kilobytes compressed). You point it at an existing select element or text input on the page and it takes over rendering from there. The original form element still exists underneath, so data submission and browser compatibility work the same way as before. The library also works with right-to-left text layouts. Configuration is done by passing an options object when initializing. There are options for limiting how many items a user can select, enabling or disabling search, controlling whether users can type in custom values that are not in the predefined list, setting placeholder text, sorting the displayed options, and customizing all the CSS class names the widget uses. The search functionality is powered by the Fuse.js fuzzy matching library, and its options can be passed through directly. Choices.js also exposes an API for controlling the widget from code. You can add, remove, disable, or clear items programmatically, and the widget fires events when selections change so other parts of the page can react. Custom HTML templates are supported for changing how individual options are rendered in the dropdown. Installation is available through npm, Yarn, or a CDN link. The README includes setup examples, a complete list of all configuration options, event names, and available methods. The full README is longer than what was shown.
← choices-js on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.