|
| 1 | +# OTP Input |
| 2 | + |
| 3 | +## Basic Usage |
| 4 | + |
| 5 | +```javascript |
| 6 | +const [OTP, SetOTP] = useState(""); |
| 7 | +// Maintain a state variable |
| 8 | + |
| 9 | +// Use it like this |
| 10 | +<OTPInput |
| 11 | + onChangeText={SetOTP} |
| 12 | + value={OTP} |
| 13 | + ... |
| 14 | + |
| 15 | + /> |
| 16 | +``` |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | +## Parameters |
| 21 | + |
| 22 | +| Parameter | required | Default | Description | |
| 23 | +| ------------------- | -------- | ------- | ------------------------------------------------------------------------- | |
| 24 | +| value | YES | | Maintain a state in parent component and use it as a controlled input | |
| 25 | +| onChangeText | YES | | the onChangeText function to update the state in parent component | |
| 26 | +| length | NO | 6 | Number of digits in the OTP | |
| 27 | +| autoFocus | NO | false | Whether to autofocus the first field | |
| 28 | +| headerTitle | NO | | The header Title above the OTP fields | |
| 29 | +| headerTitleStyle | NO | {} | header title styles | |
| 30 | +| headerTitleColor | NO | black | header title color | |
| 31 | +| activeBorderColor | NO | #03DAC6 | Color of the border bottom line if the input field is focused | |
| 32 | +| disabledBorderColor | NO | grey | Color of the blurred input fields. i.e, the fields which are out of focus | |
| 33 | +| activeBorderWidth | NO | 3 | Border Width of focused field | |
| 34 | +| disabledBorderWidth | NO | 1 | Border Width of fields which are out pof focus | |
| 35 | +| children | NO | null | children for the component if any | |
| 36 | +| HeaderComponent | NO | null | component to show above the OTP component | |
| 37 | +| FooterComponent | NO | null | component to show below the OTP component | |
| 38 | +| containerStyle | NO | {} | styles for the container that holds the whole component | |
| 39 | +| OTPContainerStyle | NO | {} | styles for the OTP container | |
| 40 | +| TextInputStyle | NO | {} | styles for the Input fields | |
0 commit comments