Closed vitorbertolucci closed 1 year ago
This has been fixed with v3
@prateek3255 the link to the migration guide on the release tag (https://github.com/devfolioco/react-otp-input/releases/tag/v3.0.0) is broken. Where can we find the migration guide to v3?
Turns out the migration instructions are on the project's readme.
Allows developers to have more control over the input fields rendered by
OtpInput
component.Resolves #318 Resolves #307 Resolves #274 And allows developers to deal with #2
It adds a prop called
inputProps
toOtpInput
component that accepts either an object containing input props that should be passed to all inputs or an array of objects containing input props that should be passed to inputs individually.Below are some examples:
1 - Passing an object to inputProps
In this example the
name
prop would be passed to all inputs. Here is how it looks like the demo:2 - Passing an array to inputProps
In this situation the props will be passed to the inputs in order. So the first element goes to the first input and so on. Note that I left the second element empty which allows me to skip it and continue to next inputs.
Here is the result in the demo: