Skip to content

Commit d3b7b2a

Browse files
♻️ UX improvements
1 parent 57ce9fb commit d3b7b2a

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ also see [multi select component](https://github.com/harshzalavadiya/react-multi
1313
- 🍃 Lightweight (2KB including styles 😎)
1414
- 💅 Themeable
1515
- ✌ Written w/ TypeScript
16+
- 🗑️ Use Backspace to remove last tag
1617

1718
## 🔧 Installation
1819

@@ -39,7 +40,6 @@ const Example = () => {
3940
<TagsInput
4041
value={selected}
4142
onChange={setSelected}
42-
seprators={["Enter", ","]}
4343
name="fruits"
4444
placeHolder="enter fruits"
4545
/>
@@ -53,16 +53,16 @@ export default Example;
5353

5454
## 👀 Props
5555

56-
| Prop | Description | Type | Default |
57-
| ------------- | -------------------------------------------- | ----------------------- | ----------- |
58-
| `name` | value for name of input | `string` | |
59-
| `placeholder` | placeholder for text input | `string` | |
60-
| `value` | initial tags | `string[]` | `[]` |
61-
| `onChange` | onChange callback (added/removed) | `string[]` | |
62-
| `onBlur` | input `onBlur` callback | `event` | |
63-
| `seprators` | when to add tag (i.e. `Space`, `,`, `Enter`) | `string[]` | `["Enter"]` |
64-
| `onExisting` | if tag is already added then callback | `(tag: string) => void` | |
65-
| `onRemoved` | on tag removed callback | `(tag: string) => void` | |
56+
| Prop | Description | Type | Default |
57+
| ------------- | -------------------------------------- | ----------------------- | ----------- |
58+
| `name` | value for name of input | `string` | |
59+
| `placeholder` | placeholder for text input | `string` | |
60+
| `value` | initial tags | `string[]` | `[]` |
61+
| `onChange` | onChange callback (added/removed) | `string[]` | |
62+
| `onBlur` | input `onBlur` callback | `event` | |
63+
| `seprators` | when to add tag (i.e. `Space`,`Enter`) | `string[]` | `["Enter"]` |
64+
| `onExisting` | if tag is already added then callback | `(tag: string) => void` | |
65+
| `onRemoved` | on tag removed callback | `(tag: string) => void` | |
6666

6767
## 💅 Themeing
6868

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-tag-input-component",
33
"description": "lightweight component for tag(s) input",
4-
"version": "1.0.3",
4+
"version": "1.0.4",
55
"license": "MIT",
66
"author": "Harsh Zalavadiya",
77
"module": "dist/react-tag-input-component.esm.js",

preview.gif

-33.8 KB
Loading

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const TagsInput = ({
8383
setTags(tags.slice(0, -1));
8484
}
8585

86-
if (e.key && (seprators || defaultSeprators).includes(e.key)) {
86+
if (text && (seprators || defaultSeprators).includes(e.key)) {
8787
if (tags.includes(text)) {
8888
onExisting && onExisting(text);
8989
return;

stories/tags-input.stories.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export const Default = () => {
1616
<TagsInput
1717
value={selected}
1818
onChange={setSelected}
19-
seprators={["Enter", ","]}
2019
name="fruits"
2120
placeHolder="enter fruits"
2221
/>

0 commit comments

Comments
 (0)