mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-07-09 06:55:07 +00:00
* feat: add input-otp * feat: update input-otp and add examples * feat(input-otp): add controlled and form examples * chore(input-otp): update to latest * docs(www): fix example code for input-otp * fix(www): disable menu
27 lines
628 B
TypeScript
27 lines
628 B
TypeScript
import React from "react"
|
|
|
|
import {
|
|
InputOTP,
|
|
InputOTPGroup,
|
|
InputOTPSeparator,
|
|
InputOTPSlot,
|
|
} from "@/registry/default/ui/input-otp"
|
|
|
|
export default function InputOTPWithSeparator() {
|
|
return (
|
|
<InputOTP
|
|
maxLength={6}
|
|
render={({ slots }) => (
|
|
<InputOTPGroup className="gap-2">
|
|
{slots.map((slot, index) => (
|
|
<React.Fragment key={index}>
|
|
<InputOTPSlot className="rounded-md border" {...slot} />
|
|
{index !== slots.length - 1 && <InputOTPSeparator />}
|
|
</React.Fragment>
|
|
))}{" "}
|
|
</InputOTPGroup>
|
|
)}
|
|
/>
|
|
)
|
|
}
|