Code Monkey home page Code Monkey logo

react-tags-input's Introduction

This repository is not being actively maintained

React-Tags-Input

An input control that handles tags interaction with copy-paste and custom type support.

demo

Live Playground

For examples of the tags input in action, check the demo page

Installation

The easiest way to use it is by installing it from NPM and include it in your own React build process.

npm install @sentisis/react-tags-input --save

Usage

Example usage:

import React from 'react';
import TagsInput from '@sentisis/react-tags-input';
// Either a copy of our demo CSS or your custom one
import './TagsInput.css';

export default class Demo extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      tags: [],
    };
  }

  render() {
    return (
      <TagsInput
        label="Tags"
        placeholder="Write tags"
        tags={this.state.tags}
        onChange={tags => this.setState({ tags })}
      />
    );
  }
}

API

Currently the component listen to the following keys: enter, esc, backspace, mod+a, mod+c and mod+v (for copy/paste).

It supports a keyboard-only copy paste (using mod+a).

copy-paste-demo

Each tag you will be passing should have the following shape:

Property Type Required Description
value String true Tag value
special Boolean false Special marks the tag as different. For example a special tag when using the case-sensitive options is a case-sensitive tag

The TagsInput component contains the following properties:

Property Type Default Description
tags Array<Tags> [] Array of tags to display
label String undefined Rendered above the field itself
placeholder String undefined Input placeholder
error String undefined Error message rendered below the field. When the field is set it will also have the class is-error
tagRenderer Function undefined Optional function that gets used to render the tag
copyButton Boolean false Renders a copy to clipboard button
copyButtonLabel String Copy to clipboard Label for the copy to clipboard button
blacklistChars Array<String> [','] Characters not allowed in the tags. Must always contain ,
specialTags Boolean false Enable the creation of special tags
specialButtonRenderer Function undefined Function that gets used to render the special button
specialButtonLabel String Special Label for the special button. Only used when a specialButtonRenderer is not defined
onChange Function noop Fired when changing the tags with the tags array as the argument
onBlur Function noop Fired as the standard React SyntheticEvent
onFocus Function noop Fired as the standard React SyntheticEvent
onSubmit Function noop Fired when the user interaction is considered complete, invoked with tags

react-tags-input's People

Contributors

albertorestifo avatar chevsky avatar dependabot[bot] avatar fjaguero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-tags-input's Issues

Prepare library to work with react 17.

Library uses componentWillUpdate life cycle hook which is deprecated and will be removed in the react@17.

Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.

* Move data fetching code or side effects to componentDidUpdate.
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

Please update the following components: TagsInput

parsing error

I installed this module and run this command
npm start
and error occurs

./node_modules/@sentisis/react-tags-input/src/TagsInput.jsx 82:2
Module parse failed: Unexpected token (82:2)
You may need an appropriate loader to handle this file type.
|
| const tagRenderer = ({ value, special }, onClick) => (

| );
|

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.