All Projects → goto-bus-stop → react-abstract-autocomplete

goto-bus-stop / react-abstract-autocomplete

Licence: MIT license
Bring-Your-Own-UI autocomplete / mentions component for React.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-abstract-autocomplete

Vue Autosuggest
🔍 Vue autosuggest component.
Stars: ✭ 492 (+3180%)
Mutual labels:  autocomplete, typeahead, autosuggest
Autosuggest Highlight
Utilities for highlighting text in autosuggest and autocomplete components
Stars: ✭ 176 (+1073.33%)
Mutual labels:  autocomplete, typeahead, autosuggest
React Input Enhancements
Set of enhancements for input control
Stars: ✭ 1,375 (+9066.67%)
Mutual labels:  autocomplete, typeahead, autosuggest
React Autowhatever
Accessible rendering layer for Autosuggest and Autocomplete components
Stars: ✭ 146 (+873.33%)
Mutual labels:  autocomplete, typeahead, autosuggest
Autosuggest Trie
Minimalistic trie implementation for autosuggest and autocomplete components
Stars: ✭ 22 (+46.67%)
Mutual labels:  autocomplete, typeahead, autosuggest
React Autosuggest
WAI-ARIA compliant React autosuggest component
Stars: ✭ 5,773 (+38386.67%)
Mutual labels:  autocomplete, typeahead, autosuggest
V Suggestions
Vue component for suggestions with custom templates
Stars: ✭ 42 (+180%)
Mutual labels:  autocomplete, autosuggest
Autocomplete
🔮 Fast and full-featured autocomplete library
Stars: ✭ 1,268 (+8353.33%)
Mutual labels:  autocomplete, typeahead
Downshift
🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.
Stars: ✭ 10,183 (+67786.67%)
Mutual labels:  autocomplete, autosuggest
Zsh Autocomplete
🤖 Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.
Stars: ✭ 641 (+4173.33%)
Mutual labels:  autocomplete, typeahead
React Autocomplete Hint
A React component for Autocomplete Hint.
Stars: ✭ 131 (+773.33%)
Mutual labels:  autocomplete, typeahead
React Selectrix
A beautiful, materialized and flexible React Select control
Stars: ✭ 166 (+1006.67%)
Mutual labels:  autocomplete, autosuggest
addressr
Free Australian Address Validation, Search and Autocomplete
Stars: ✭ 46 (+206.67%)
Mutual labels:  autocomplete, autosuggest
Bootstrap 4 Autocomplete
A simple autocomplete/typeahead for Bootstrap 4 and jQuery
Stars: ✭ 36 (+140%)
Mutual labels:  autocomplete, typeahead
React Input Tags
React component for tagging inputs.
Stars: ✭ 10 (-33.33%)
Mutual labels:  autocomplete, autosuggest
react-power-select
A highly composable & reusable select/autocomplete components
Stars: ✭ 63 (+320%)
Mutual labels:  autocomplete, typeahead
Autocomplete
Blazing fast and lightweight autocomplete widget without dependencies. Only 1KB gzipped. Demo:
Stars: ✭ 244 (+1526.67%)
Mutual labels:  autocomplete, typeahead
react-native-autocomplete-dropdown
Dropdown Item picker with search and autocomplete (typeahead) functionality for react native
Stars: ✭ 87 (+480%)
Mutual labels:  autocomplete, typeahead
indicium
🔎 A simple in-memory search for collections and key-value stores.
Stars: ✭ 41 (+173.33%)
Mutual labels:  autocomplete, typeahead
Ng Select
⭐ Native angular select component
Stars: ✭ 2,781 (+18440%)
Mutual labels:  autocomplete, typeahead

react-abstract-autocomplete

Bring-Your-Own-UI autocomplete component for React.

Examples - Examples source code - Installation - Usage - License

Installation

npm install --save react-abstract-autocomplete

Usage

import AutoComplete, { Completion } from 'react-abstract-autocomplete';

const users = [];
const chatCommands = [];

<AutoComplete inputComponent="input">
  <Completion trigger="@" completions={users} minLength={1} />
  <Completion trigger="/" completions={chatCommands} minLength={1} />
</AutoComplete>

For full usage examples, check out the Examples page, and the projects in the examples/ directory.

AutoComplete

Name Type Default Description
inputComponent one of:
 string
 function
'input' Component to use for rendering the input element. Uses native <input /> by default.
The component should accept value, onChange and onKeyDown props.
inputProps object { type: 'text',} Props to pass to the input component.
renderSuggestion function <div key={key} onClick={select}>{value}</div> Function that renders a single suggestion. This can be overridden for individual Completion types, in case they need custom rendering.

Signature:
function(suggestion: Object) => ReactElement
suggestion: Suggestion descriptor.
suggestion.key: Unique key for the suggestion element. See Dynamic Children for details.
suggestion.value: Completion value of this suggestion.
suggestion.selected: Whether this suggestion is currently selected.
suggestion.select: Autocomplete this suggestion.
renderSuggestions function <div>{suggestions}</div> Function that renders the suggestions list.

Signature:
function(suggestions: Array) => ReactElement
suggestions: Array of children rendered by renderSuggestion.
children node [] Completion types as <Completion /> elements.
limit number 15 The maximum amount of suggestions to show.
value string Current string value of the input component. Optional, useful for controlled inputs. Passed down to the input component as the value prop.
defaultValue string '' Initial string value for uncontrolled inputs.
onUpdate function () => {} Fired when the input component's value changes. Use this for controlled inputs.

Signature:
function(newValue: string) => void
newValue: null

Completion

<Completion /> elements describe different data sources. Multiple can be used in the same <AutoComplete /> component.

Name Type Default Description
trigger (required) one of:
 string
 RegExp
String that triggers this completion type.
minLength number 3 Minimum amount of characters typed before suggestions will be given.
regex RegExp null Regex to extract the current completion value from the input. Can also be used to "validate" the current completion value, so no suggestions will be provided if it's "invalid".
Uses the first capture group as the value to be completed, or the full match if there are no capture groups. For example: - /.*(@.*?)$/ + "Hello @ReA" → "@ReA" - /\w+$/ + "This is sp" → "sp"
renderSuggestion function null Function that renders a single suggestion.

Signature:
function(suggestion: Object) => ReactElement
suggestion: Suggestion descriptor.
suggestion.key: Unique key for the suggestion element. See Dynamic Children for details.
suggestion.value: Completion value of this suggestion.
suggestion.selected: Whether this suggestion is currently selected.
suggestion.select: Autocomplete this suggestion.
getCompletions function Searches the completions prop. Get an array of possible completions.

Signature:
function(matchingValue: string, props: Object) => undefined
matchingValue: Current value to be completed, as extracted using props.regex.
props: Props of this <Completion /> element.
completions array [] Optional array of completion values. This can be used if all possible completions are known beforehand. If provided, a default getCompletions function that searches this array will be used.
getText function (value, { trigger }) => ${trigger}${value} Transform a completion value to a string that will be inserted into the input component. By default, uses `${props.trigger}${value} `. (Note the space at the end! If you want to add a space once a completion is inserted, add it here.)

Signature:
function(value: undefined, props: Object) => string
value: Completion value.
props: Props of this <Completion /> element.

License

MIT

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].