All Projects → celebryts → react-autocomplete-tags

celebryts / react-autocomplete-tags

Licence: other
React Autocomplete Tags

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

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

Ngx Chips
Tag Input component for Angular
Stars: ✭ 840 (+4841.18%)
Mutual labels:  autocomplete, tags
react-native-element-textinput
A react-native TextInput, TagsInput and AutoComplete component easy to customize for both iOS and Android.
Stars: ✭ 28 (+64.71%)
Mutual labels:  autocomplete, tags
Vue Tags Input
A tags input component for VueJS
Stars: ✭ 761 (+4376.47%)
Mutual labels:  autocomplete, tags
Contentful Tags Autocomplete Extension
UI Extension for Contenful (CMS) to add an autocompleting tags widget to content types
Stars: ✭ 10 (-41.18%)
Mutual labels:  autocomplete, tags
React Input Tags
React component for tagging inputs.
Stars: ✭ 10 (-41.18%)
Mutual labels:  autocomplete, tags
Jstag
Pure Angular Input Tags project
Stars: ✭ 140 (+723.53%)
Mutual labels:  autocomplete, tags
V Tag Suggestion
A simple tag component with typeahead
Stars: ✭ 40 (+135.29%)
Mutual labels:  autocomplete, tags
React Selectrix
A beautiful, materialized and flexible React Select control
Stars: ✭ 166 (+876.47%)
Mutual labels:  autocomplete, tags
zsh-yarn-completions
Yarn completions for Z-shell that supports yarn workspaces
Stars: ✭ 35 (+105.88%)
Mutual labels:  autocomplete
tagselector
Dependency-free JS library that turns select fields in customizable tag clouds
Stars: ✭ 19 (+11.76%)
Mutual labels:  tags
Inquirer Autocomplete Prompt
Autocomplete prompt for inquirer
Stars: ✭ 250 (+1370.59%)
Mutual labels:  autocomplete
react-power-select
A highly composable & reusable select/autocomplete components
Stars: ✭ 63 (+270.59%)
Mutual labels:  autocomplete
gitlab-release-note-generator
A Gitlab release note generator
Stars: ✭ 88 (+417.65%)
Mutual labels:  tags
S2s
Coding time Compile. A tool to write code fastest.
Stars: ✭ 254 (+1394.12%)
Mutual labels:  autocomplete
vue-thailand-address-autocomplete
🇹🇭 Autocomplete ที่อยู่ในประเทศไทย
Stars: ✭ 49 (+188.24%)
Mutual labels:  autocomplete
Openautocomplete
OpenAutoComplete -- CLI autocomplete specification
Stars: ✭ 249 (+1364.71%)
Mutual labels:  autocomplete
Academic Phrases
Bypass that mental block when writing your papers.
Stars: ✭ 244 (+1335.29%)
Mutual labels:  autocomplete
11r
America's favorite Eleventy blog template.
Stars: ✭ 135 (+694.12%)
Mutual labels:  tags
LiDARTag
This is a package for LiDARTag, described in paper: LiDARTag: A Real-Time Fiducial Tag System for Point Clouds
Stars: ✭ 161 (+847.06%)
Mutual labels:  tags
vim-stylus
A better vim plugin for stylus, including proper and up-to-date syntax highligting, indentation and autocomplete
Stars: ✭ 49 (+188.24%)
Mutual labels:  autocomplete

react-autocomplete-tags

A React component that build a Autocomplete with tags.

Demos

https://celebryts.github.io/react-autocomplete-tags

Installation

npm install @celebryts/react-autocomplete-tags --save

or

yarn add @celebryts/react-autocomplete-tags

Basic Usage

import React, { Component } from 'react'
import Autocomplete from 'react-autocomplete-tags'

class Example extends Component {

  constructor(props){
    super(props)
    this.state = {
      suggestions: [
        {
          label: 'Suggestions 1',
          value: '1'
        },
        {
          label: 'Suggestions 2',
          value: '2'
        },
        {
          label: 'Another suggestions',
          value: 'X'
        }
      ]
    }
  }

  onChange = (value) => {
    console.log('Value received from onChange: ' + value)
  }

  render(){
    return (
      <Autocomplete
        suggestions={this.state.suggestions}
        onChange={this.handleChange}
      />
    )
  }
}

Props

Prop Type Default Description
className String '' Classname to style the root div.
placeholder String '' Placeholder on input box.
suggestions Array [] Suggestions to show.
tags Array [] Visible tags in input.
limitTags Number null Maximum allowed tags.
allowCreateTag Boolean true If user can create tags without restritions.
saveOnBlur Boolean false If component must add current input value on blur.
delay Number null Delay in onChange event after user changes.
onKeyUp Function ()=>{} Callback for key up event.
onKeyDown Function ()=>{} Callback for key down event.
onFocus Function ()=>{} Callback for focus event.
onChange Function ()=>{} Callback for changes in input.

className : String

Css class to stylize the component:

<Autocomplete className="my-css-class" />

This will be applied into <div> element that wrap the other Autocomplete elements.

You can style elements like this:

.my-css-class{
  background-color: #f0f0f0;
}

.my-css-class > div{
  padding: 20px 0;
}

.my-css-class input{
  margin: 0 10px;
}

placeholder : String

Placeholder on autocomplete input box.

<Autocomplete placeholder="Insert your tags here" />

suggestions : Array

Array of suggestions to show. It needs to be an array of objects:

<Autocomplete suggestions={
  [
    {
      label: 'Suggestion 1',
      value: 'IdOfSuggestion1'
    },
    {
      label: 'Suggestion 2',
      value: 'IdOfSuggestion2'
    }
  ]
} />

label is the text to be showed on suggestions area of the Autocomplete.

value is the value of the showed label.

It's similar to the label/value funcionality of HTML <option> .

tags : Array

Array of tags that are initially rendered on input. The usage is similar to suggestions.

<Autocomplete tags={
  [
    {
      label: 'Tag 1',
      value: 'IdOfTag1'
    },
    {
      label: 'Tag 2',
      value: 'IdOfTag2'
    }
  ]
} />

limitTags : Number

You can set whether the input will have a limit amout.

<Autocomplete
  limitTags={2}
  tags={
    [
      {
        label: 'Tag 1',
        value: 'IdOfTag1'
      }
    ]
  }
/>

In the above example, user will be able to add only 2 tags. (Or erase the first and write another 3).

allowCreateTag : Boolean

Its possible block the creation of tags, thus the user will be able to put only tags that were been suggesteds in input.

<Autocomplete
  allowCreateTag={false}
  suggestions={
    [
      {
        label: 'Choose one option',
        value: 'IdOfSuggestion1'
      },
      {
        label: 'You cannot create tags',
        value: 'IdOfSuggestion1'
      },
      {
        label: 'Last chance',
        value: 'IdOfSuggestion2'
      }
    ]
  }
/>

saveOnBlur : Boolean

When the event blur occurs, the typed text (even if not sent) will be transformed into a tag.

<Autocomplete saveOnBlur={true} />

delay : Number

Sometimes we don't need the event onChange immediately after user action, so, we can add a delay (milliseconds) to this happen.

<Autocomplete
  delay={300}
  onChange={this.handleChange}
/>

Issues

You can report your issues here

Pull Requests

Pull Requests are always welcome! :)

Clone the repository: https://github.com/celebryts/react-autocomplete-tags, and run the command:

npm run dev

Authors

Built by Celebryts

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