Input OTP
A one-time code in cells, typed, pasted or filled from a text message.
forSlots(OtpFieldSlots)(Recipes.OtpField({}))
Usage
The function that drew the preview, over the theme module Create a theme writes. The preview passes it the style picked above instead of its default.
export const OtpFieldStyle = forSlots(OtpFieldSlots)(Recipes.OtpField({}))
export const otpField = <Message>(
style: NamedStyle<typeof OtpFieldSlots>,
code: string,
onChange: (code: string) => Message,
h: HtmlBuilder<Message>,
): Html => OtpField.view({ label: 'Sign-in code', value: code, onChange, groups: [3, 3], style }, h)