Input prohibition
#4738
-
Hello. Is it possible to prohibit the entry of numbers into the input? |
Beta Was this translation helpful? Give feedback.
Answered by
Rall3n
Aug 23, 2021
Replies: 1 comment 2 replies
-
Hello @foxter111, I hope you don't mind me converting your issue into a discussion, as this is a more appropriate place for questions. In its current state you can't directly prohibit the input of numbers into the <Select
onInputChange={(inputValue) => {
let value = inputValue.replace(/\d/g, '');
// Either setState when controlled
setInputValueState(value);
// or return for uncontrolled.
return value;
}}
/> |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
foxter111
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @foxter111,
I hope you don't mind me converting your issue into a discussion, as this is a more appropriate place for questions.
In its current state you can't directly prohibit the input of numbers into the
Select
component (by using<input pattern="">
).But you can remove numbers from the input by using the
onInputChange
prop.CodeSandbox example