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

Relationship Graph

Source Code

apps/v4/registry/bases/base/ui/input-otp.tsx lines 43–71

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(
        "cn-input-otp-slot relative flex items-center justify-center data-[active=true]:z-10",
        className
      )}
      {...props}
    >
      {char}
      {hasFakeCaret && (
        <div className="cn-input-otp-caret pointer-events-none absolute inset-0 flex items-center justify-center">
          <div className="cn-input-otp-caret-line" />
        </div>
      )}
    </div>
  )
}

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free