DS | Adila.co
Componentes

Input Otp

Componente input-otp do design system adila.co.

1
2
3
4
5
6

Instalação

bun add @adila-sh/ui

Uso

import {
  InputOTP,
  InputOTPGroup,
  InputOTPSlot,
  InputOTPSeparator,
} from '@adila-sh/ui';

export function Example() {
  return (
    <InputOTP maxLength={6}>
      <InputOTPGroup>
        <InputOTPSlot index={0} />
        <InputOTPSlot index={1} />
        <InputOTPSlot index={2} />
      </InputOTPGroup>
      <InputOTPSeparator />
      <InputOTPGroup>
        <InputOTPSlot index={3} />
        <InputOTPSlot index={4} />
        <InputOTPSlot index={5} />
      </InputOTPGroup>
    </InputOTP>
  );
}

maxLength define a quantidade de dígitos. Cada InputOTPSlot recebe o index correspondente, e InputOTPSeparator é opcional entre grupos.

Dependências

  • input-otp
  • lucide-react

Nesta página