🔮 Fast and full-featured autocomplete library
翻译准备中
开发工具TypeScript · SCSSGitHub @algolia自行安装运营者未确认
试用过了吗? 点一下就好,无需登录。
尚未检测到更新。GitHub 发布版本后会显示在这里。
制作者的介绍仅有上面的一句话。 更多详情请阅读仓库 README。 仓库 README ↗
正在加载完整 README。
查看完整 README ↗All you need to get started is:
The data that populates the autocomplete results are called sources. You can use whatever you want in your sources: a static set of searches terms, search results from an external source like an Algolia index, recent searches, and more.
By configuring just those two required parameters (container and getSources) you can have an interactive autocomplete experience. The library creates an input and provides the interactivity and accessibility attributes, but you're in full control of the DOM elements to output.
The recommended way to get started is with the autocomplete-js package. It includes everything you need to render a JavaScript autocomplete experience.
Otherwise, you can install the autocomplete-core package if you want to build a renderer from scratch.
All Autocomplete packages are available on the npm registry.
yarn add @algolia/autocomplete-js
# or
npm install @algolia/autocomplete-js
If you don't use a package manager, you can use the HTML script element:
<script src="https://cdn.jsdelivr.net/npm/@algolia/autocomplete-js"></script>
<script>
const { autocomplete } = window['@algolia/autocomplete-js'];
</script>
To get started, you need a container for your autocomplete to go in. If you don't have one already, you can insert one into your markup:
<div id="autocomplete"></div>
Then, insert your autocomplete into it by calling the autocomplete function and providing the container. It can be a CSS selector or an Element.
Make sure to provide a container (e.g., a div), not an input. Autocomplete generates a fully accessible search box for you.
import { autocomplete } from '@algolia/autocomplete-js';
autocomplete({
container: '#autocomplete',
// ...
});
Continue reading our Getting Started guide.
The documentation offers a few ways to learn about the Autocomplete library:
You can find more on the documentation.
以上为 README 的开头部分。其余内容请阅读原文。 查看完整 README ↗