-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TagInput] add separator, onChange, placeholder props #1418
Conversation
🔥 `onAdd` now receives `string[]` instead of single `string`!
TagInput placeholder prop appears only when values is emptyPreview: documentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving with two tiny touch-up requests.
} | ||
} | ||
|
||
/** Invokes `onAdd` and `onChange` accordingly to remove the item at the given index. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onRemove, not onAdd
packages/labs/test/tagInputTests.tsx
Outdated
const value = "one, two, three"; | ||
const onAdd = sinon.stub(); | ||
const wrapper = mountTagInput(onAdd, { separator: false }); | ||
// extra spaces to exercise `\s*` in regexp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we delete this comment?
better comments + value splitting ⚛️Preview: documentation |
update docs for new props, default separator just ","Preview: documentation |
Addresses #1412
Changes proposed in this pull request:
separator
prop allows adding multiple entries at onceonChange
prop combinesonAdd
andonRemove
for easy controlling (and implements basic array manipulation logic)placeholder
prop appears only whenvalues
is emptyinputProps.placeholder
if you want it to appear all the timeonAdd
now receivesstring[]
instead of singlestring
Reviewers should focus on: