Kwik Outlined OTP
fun KwikOutlinedOTP(onValidOTP: (TextFieldValue) -> Unit, size: Int = 6, isError: Boolean = false, error: String, visualTransformation: VisualTransformation = VisualTransformation.None, clearAll: Boolean = false, shape: Shape = MaterialTheme.shapes.small, colors: TextFieldColors = kwikOutlinedTextFieldColors(), onKeyboardDone: () -> Unit = { })
OTP input. The OTP field will automatically move focus to the next field when a digit is entered.
Parameters
on Valid OTP
: Callback that is called when a valid OTP is entered. The TextFieldValue contains the OTP.
size
: The number of fields in the OTP. Default is 6.
is Error
: If true, the error message will be displayed.
error
: The error message to display.
visual Transformation
: The visual transformation to apply to the OTP fields. Default is VisualTransformation.None. Pass in PasswordVisualTransformation for password masking.
clear All
: If true, all OTP fields will be cleared.
on Keyboard Done
: Callback that is called when the user presses the done key on the keyboard.
Example usage:
KwikOTP(
onValidOTP = { otp ->
// handle valid OTP
},
error = "Invalid OTP"
)
Content copied to clipboard