Home / Function/ InputOTPSlot() — ui Function Reference

InputOTPSlot() — ui Function Reference

Architecture documentation for the InputOTPSlot() function in input-otp.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  460fc5e5_e1c5_a906_3969_dfd17a00205e["InputOTPSlot()"]
  9e2b1c80_9408_ae92_83fe_f879d2454ae1["input-otp.tsx"]
  460fc5e5_e1c5_a906_3969_dfd17a00205e -->|defined in| 9e2b1c80_9408_ae92_83fe_f879d2454ae1
  style 460fc5e5_e1c5_a906_3969_dfd17a00205e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/registry/new-york-v4/ui/input-otp.tsx lines 39–67

function InputOTPSlot({
  index,
  className,
  ...props
}: React.ComponentProps<"div"> & {
  index: number
}) {
  const inputOTPContext = React.useContext(OTPInputContext)
  const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}

  return (
    <div
      data-slot="input-otp-slot"
      data-active={isActive}
      className={cn(
        "data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",
        className
      )}
      {...props}
    >
      {char}
      {hasFakeCaret && (
        <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
          <div className="animate-caret-blink bg-foreground h-4 w-px duration-1000" />
        </div>
      )}
    </div>
  )
}

Subdomains

Frequently Asked Questions

What does InputOTPSlot() do?
InputOTPSlot() is a function in the ui codebase, defined in apps/v4/registry/new-york-v4/ui/input-otp.tsx.
Where is InputOTPSlot() defined?
InputOTPSlot() is defined in apps/v4/registry/new-york-v4/ui/input-otp.tsx at line 39.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free