selectize.js README

The project's README from github.com/selectize/selectize.js. As one markdown file: README.md.

selectize.js

Selectize.js

→ Selectize is looking for new members on the maintenance team!

NPM version CDNJS version
Node.js CI
Discussion & Help

Selectize is an extensible jQuery-based custom <select>; UI control. It's useful for tagging, contact lists, country selectors, and so on. The goal is to provide a solid & usable experience with a clean and powerful API.

Features

Dependencies

Optional:

Installation

Selectize can be installed via NPM npm install @selectize/selectize

Installing Manually

All pre-built files needed to use Selectize can be found in the "dist" folder.

If you're looking to get started with minimal fuss, include selectize.min.js (bundles Sifter and Microplugin dependencies – also available un-minified for debugging, just remove the .min part) and css/selectize.default.css.

Selectize is available at cdnjs.

Usage

$("select").selectize(options);

The available options are documented here.

Contributing

When issuing a pull request:

Add an entry to the top of the CHANGELOG, and update the documentation in docs/ as needed. (Refactors and documentation changes don't need a changelog entry.)

Squash your commits together in one or a few complete, logical commits, with a concise and descriptive message. One commit means one feature/bugfix/thing that has changed, or a diff bringing the code one step forward to a better, working state.

Once your commit is nice and clean, and you want to discard the other changes, you can use git checkout . (that will erase changes to tracked files) and git clean [-i/--interactive] (to erase untracked files). However, be careful with those commands, as their function is to erase things/changes.

However, be careful not to add the dist/ files in your commit, as Grunt automatically regenerates the files in dist/ as the source is changed.

Tests

Please ensure all the tests pass:

npm test # defaults to ChromHeadless
BROWSERS=Firefox npm test
BROWSERS=Firefox,Chrome npm test
BROWSERS=Firefox,Chrome,Safari npm test

Local environment

To run Selectize locally:

npm start

You can then run the examples at https://loopback.website:4000/.

License

Copyright © 2013–2016 Brian Reavis & Contributors
Copyright © 2020-2022 Selectize Team & Contributors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

selectize.js (selectize/selectize.js)

Searching Database…

13K ·GitHub
archived
这是什么东西?Selectize 是一个基于 jQuery 的界面控件,可以把普通的文本输入框或下拉选择框变成两者的结合体,带自动补全和接近原生手感的键盘操作。典型用途有:标签选择、联系人列表、国家地区选择器。
它是一个框架,还是只是一个 jQuery 插件?是一个 jQuery 插件:把它挂到 input 或 select 元素上就能升级这个元素。它以 npm 包 @selectize/selectize 的形式发布,自带编译好的 JS 和 CSS 文件,额外功能则通过基于 microplugin 的插件 API 来扩展。
我怎么把它加到我的项目里?运行 npm install @selectize/selectize,也可以手动添加:从 dist 文件夹里引入 selectize.min.js 和 css/selectize.default.css —— 同样的预编译文件在 cdnjs 上也有。
需要 jQuery 吗?要哪个版本?需要 —— jQuery 1.7 或更高版本,作为 peer dependency。在 npm 3 及以上版本中要自己安装(比如 npm install --save [email protected]);jquery-ui 是可选的,只有拖拽插件才需要它。
这个项目还在维护吗?不算活跃维护了:GitHub 仓库已经归档,README 也说 Selectize 正在寻找新的维护团队成员 —— 可以把它当成稳定但更新缓慢的项目,而不是仍在积极开发的项目。
它比普通下拉框多能做什么?选项会通过 Sifter 实时搜索并按相关度排序(标题和描述都参与匹配);可以用方向键在已选项之间移动光标;配合 option/ctrl 可以一次选中或删除多个条目;带变音符号的字符开箱即用;触屏操作支持 iOS 5 及以上。
选项能不能在用户输入时从服务器加载?可以 —— 远程数据加载正是为这种场景设计的:当你有成千上万个选项时,由服务器在用户输入的同时提供。
用户能自己添加新条目吗,比如新标签?可以 —— 条目创建功能让用户随时添加新条目,还支持异步保存:在你的保存回调触发之前,控件会保持锁定状态。
它能和我的 Bootstrap 网站风格搭配吗?可以 —— 它自带 Bootstrap 2、3、4、5 的预置主题,另外还提供 SCSS 和 Less 源文件,方便你自己定制样式。
Creator
selectize
Size
27.3 MB
Stars
13K
Age
14y
Commits · 90 Days