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
  ecc924bb_098d_da71_0b84_0bb2a3b6c94b["InputOTPSlot()"]
  b7134d6c_85ed_ee0f_46b6_0b08cf0a1c20["input-otp.tsx"]
  ecc924bb_098d_da71_0b84_0bb2a3b6c94b -->|defined in| b7134d6c_85ed_ee0f_46b6_0b08cf0a1c20
  style ecc924bb_098d_da71_0b84_0bb2a3b6c94b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/examples/radix/ui/input-otp.tsx lines 42–70

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(
        "dark:bg-input/30 border-input 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 relative flex size-8 items-center justify-center border-y border-r text-sm transition-all outline-none first:rounded-l-lg first:border-l last:rounded-r-lg data-[active=true]:z-10 data-[active=true]:ring-3",
        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/examples/radix/ui/input-otp.tsx.
Where is InputOTPSlot() defined?
InputOTPSlot() is defined in apps/v4/examples/radix/ui/input-otp.tsx at line 42.

Analyze Your Own Codebase

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

Try Supermodel Free