Skip to content
Back to skills

Lynx Ui Input Otp

ASecurity

Build headless, configurable-length OTP, PIN, and verification-code inputs with lynx-ui InputOTP.

  • 119 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 3, 2026
designreactnode

Security analysis

A100/100

Pro scans all 20 files and shows the line behind each finding

Scanned September 3, 2026

npx -y skills add lynx-family/lynx-ui --skill lynx-ui-input-otp --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Lynx Ui Input Otp?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Lynx Ui Input Otp
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/lynx-family-lynx-ui-input-otp/badge)](https://www.skillsdirectory.com/skills/lynx-family-lynx-ui-input-otp)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: InputOTP
description: Build headless, configurable-length OTP, PIN, and verification-code inputs with lynx-ui InputOTP.
---

# lynx-ui InputOTP

## Requirements

InputOTP requires Lynx SDK 4.0 or newer.

## Core capabilities

InputOTP owns value and keyboard behavior through one hidden native input.
Consumers compose the visible interface with InputOTPSlot. It supports:

- A configurable positive number of numeric, alphabetic, or alphanumeric ASCII
  characters.
- Controlled and uncontrolled values.
- Completion, focus, and blur callbacks.
- Imperative focus, blur, set, clear, and read methods.
- Consumer-defined slot layout, separators, masking, caret, themes, and RTL.
- Typed `ui-*` state variants and render props without visible package CSS.

## Minimal example

```tsx
import { useState } from '@lynx-js/react'
import { InputOTP, InputOTPSlot } from '@lynx-js/lynx-ui'

function VerificationCode() {
  const [code, setCode] = useState('')

  return (
    <InputOTP
      autoFocus
      length={6}
      value={code}
      onChange={setCode}
      onComplete={(completeCode) => {
        console.log('verify', completeCode)
      }}
    >
      {Array.from(
        { length: 6 },
        (_, index) => (
          <InputOTPSlot
            key={index}
            index={index}
            className='otp-slot'
          />
        ),
      )}
    </InputOTP>
  )
}
```

## Usage guidance

- Render one InputOTPSlot for every configured index.
- Pass a positive integer to `length`; invalid values fall back to six slots.
- Use `inputType="numeric"`, `"alphabetic"`, or `"alphanumeric"` to choose
  both the native keyboard and accepted ASCII characters.
- Prefer controlled mode when a parent submits, validates, or resets the
  value.
- Use `InputOTPRef.clear()` to reset an uncontrolled field. In controlled
  mode, update the value prop from `onChange`.
- Treat `onComplete` as a readiness signal and keep network submission in the
  parent.
- Implement masking with the InputOTPSlot render function. The original value
  remains available to InputOTP callbacks.
- Insert separator nodes directly between InputOTPSlot children.
- Use `className` and `style` for base slot styling. On the root, target
  `ui-focused`, `ui-complete`, `ui-disabled`, and `ui-invalid`. On slots,
  target `ui-focused`, `ui-filled`, `ui-complete`, `ui-disabled`, and
  `ui-invalid`. Use the slot render function when custom character or caret
  nodes need their own presentation.
- Apply `direction: rtl` to the outer container and let descendants inherit it.

## Masked slot example

```tsx
<InputOTPSlot index={0}>
  {({ filled }) =>
    filled ? <text>•</text> : null}
</InputOTPSlot>
```

## Component roles

- `InputOTP`: owns the native input, normalized value, callbacks, and context.
- `InputOTPSlot`: consumes a zero-based character index and renders either the
  default character/caret nodes or custom render-prop content.

Files in this skill

  • CHANGELOG.md703 B
  • LICENSE11.1 KB
  • README.md1 KB
  • SKILL.md2.9 KB
  • __tests__/utils.test.ts1.5 KB
  • docs/APIReference.mdx15.3 KB
  • docs/README.mdx267 B
  • docs/README.zh.mdx274 B
  • package.json1.2 KB
  • rslib.config.ts338 B
  • src/InputOTP.tsx7.1 KB
  • src/InputOTPContext.ts598 B
  • src/InputOTPSlot.tsx1.7 KB
  • src/index.tsx497 B
  • src/types/index.docs.ts9.3 KB
  • src/types/index.ts225 B
  • src/utils.ts889 B
  • tsconfig.docs.json122 B
  • tsconfig.json141 B
  • vitest.config.ts368 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.