-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Feature Request: maxLength #55
Comments
Not the best case but you can do this: const [availableKeywords, setAvailableKeywords] = useState<string>("Max. 10 keywords")
useEffect(() => {
setAvailableKeywords(keywords.length === 0 ? `Max. 10 keywords` : `${10-keywords.length} keywords left`)
}, [keywords])
const checkMaxLengthkeywords = () => {
return keywords.length < 10 ? true : false
}
return (
<TagsInput
classNames={{tag: 'keywordTag', input: 'inputImg'}}
value={keywords}
onChange={setKeywords}
name="keywords"
separators={["Enter",","]}
placeHolder={availableKeywords}
beforeAddValidate={checkMaxLengthkeywords}
/>
) |
you can use something like:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add the maxLength attribute.
The text was updated successfully, but these errors were encountered: