# InputOTP

> A segmented one-time-code input.

- Category: [Inputs & forms](https://tarve.dev/docs.md#inputs)
- Import: `import { InputOTP } from "@tarve/core";`
- Props type: `InputOTPProps`
- Source: [packages/core/src/form-controls.ts:196](https://github.com/omarcosr/tarve/blob/main/packages/core/src/form-controls.ts#L196)

## Usage

```tsx title="InputOTP.tsx"
import { InputOTP } from "@tarve/core";

let code = "";

<InputOTP
  id="code"
  length={6}
  value={code}
  onValueChange={(value) => {
    code = value;
  }}
/>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` (required) | `string` | — |  |
| `disabled` | `boolean` | — |  |
| `length` | `number` | `6` |  |
| `mask` | `boolean` | `false` |  |
| `onValueChange` | `(value: string) => void` | — |  |
| `pattern` | `RegExp` | `/^[0-9]$/` |  |
| `slotWidth` | `number` | `36` |  |

## Common props

Shared by every component (descriptions: https://tarve.dev/docs.md#common-props): `children`, `class`, `className`, `highlight`, `id`, `key`, `motionFrom`, `onHighlight`, `onPaste`, `onPointerLeave`, `onPointerMove`, `onSize`, `onTransitionEnd`, `rovingGroup`, `style`.

Previous: [InputGroup](https://tarve.dev/docs/components/InputGroup.md) · Next: [Field](https://tarve.dev/docs/components/Field.md)

---

Tarve v0.13.8 · HTML version: https://tarve.dev/docs/components/InputOTP · Index for agents: https://tarve.dev/llms.txt
