Input OTP
Códigos de verificação de um caractere por slot.
Campos e formulários
Carregando demonstração…
Código da demo
"use client";
import * as React from "react";
import {
InputOTP,
InputOTPGroup,
InputOTPSeparator,
InputOTPSlot,
} from "@/components/ui/input-otp";
import { Label } from "@/components/ui/label";
export function Demo() {
const [value, setValue] = React.useState("");
return (
<div className="grid gap-fe-2">
<Label htmlFor="otp">Código</Label>
<InputOTP
id="otp"
maxLength={6}
value={value}
onChange={setValue}
>
<InputOTPGroup>
<InputOTPSlot index={0} />
<InputOTPSlot index={1} />
<InputOTPSlot index={2} />
</InputOTPGroup>
<InputOTPSeparator />
<InputOTPGroup>
<InputOTPSlot index={3} />
<InputOTPSlot index={4} />
<InputOTPSlot index={5} />
</InputOTPGroup>
</InputOTP>
</div>
);
}- Acessibilidade
- Um campo lógico; slots navegáveis; autocomplete one-time-code.
- Importar
import { InputOTP, InputOTPGroup, InputOTPSlot } from "@financeequity/ui/input-otp"Neste repositório:
import { InputOTP, InputOTPGroup, InputOTPSlot } from "@/components/ui/input-otp"- Dependências
- input-otp