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

Relationship Graph

Source Code

apps/v4/examples/base/ui-rtl/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-e text-sm transition-all outline-none first:rounded-s-lg first:border-s last:rounded-e-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/base/ui-rtl/input-otp.tsx.
Where is InputOTPSlot() defined?
InputOTPSlot() is defined in apps/v4/examples/base/ui-rtl/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