Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/developit/preact-token-input

:bookmark: A text field that tokenizes input, for things like tags.
https://github.com/developit/preact-token-input

preact preact-components tag-input tagging tags

Last synced: about 2 months ago
JSON representation

:bookmark: A text field that tokenizes input, for things like tags.

Awesome Lists containing this project

README

        

# preact-token-input

[![NPM](http://img.shields.io/npm/v/preact-token-input.svg)](https://www.npmjs.com/package/preact-token-input)
[![travis-ci](https://travis-ci.org/developit/preact-token-input.svg)](https://travis-ci.org/developit/preact-token-input)

A text field that tokenizes input, for things like tags.

> **[CodePen Demo](http://codepen.io/developit/pen/WrxmGx?editors=001)**
>
> ![preact-token-input](https://i.gyazo.com/36d5e8d0e0f7f04301a503d0fa5fd270.gif)

---

### Usage Example

Use `` like a normal ``. It supports the same props/attributes, including `value`, `onInput()` and `onChange()`.

```js
import TokenInput from 'preact-token-input';

const Tags = ({ tags, ...props }) => (

Add some tags:


);

let tags = ['new', 'noteworthy', 'tech'];
render(, document.body);
```

### Usage with Linked State

`` works with Linked State exactly the same way as any other input field:

```js
import TokenInput from 'preact-token-input';

class Form extends Component {
render(props, { tags }) {
return (



);
}
}

render(, document.body);
```

---

### License

[MIT]

[Preact]: https://github.com/developit/preact
[MIT]: http://choosealicense.com/licenses/mit/