---
productId: material-ui
title: React OTP Field component
components: OTPField, OTPFieldInput, OTPFieldSeparator, FormControl, FormLabel, FormHelperText
githubSource: packages/mui-material/src/OTPField
---

# OTP Field

An OTP field lets users enter a one-time password or verification code, one character per input.

Use an OTP field for fixed-length codes, such as a sign-in code sent by text message or a recovery code printed on a card.



## Basic OTPField

`OTPField` accepts six digits by default and renders one input per digit. Use `length` to change the number of inputs.
Users can type the digits one at a time, paste the whole code, or autofill it in browsers that support `autoComplete="one-time-code"` (the default).
Use `label` to name the field and `helperText` to tell users where to find the code.

```tsx
import OTPField from '@mui/material/OTPField';

export default function BasicOTPField() {
  return (
    // @focus-start @padding 2
    <OTPField
      label="Verification code"
      helperText="Enter the six-digit code from your text message."
    />
    // @focus-end
  );
}
```

## Form props

Use `required` to require a complete code. Users can focus and submit a `readOnly` field. Setting `disabled` removes it from the tab order and form data.
Set `mask` to hide the characters as the user enters them. The value still contains the original characters.

```tsx
import Box from '@mui/material/Box';
import OTPField from '@mui/material/OTPField';

export default function FormPropsOTPFields() {
  return (
    <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 3 }}>
      <OTPField label="Required" length={4} required />
      <OTPField label="Disabled" length={4} defaultValue="0123" disabled />
      <OTPField label="Read only" length={4} defaultValue="0123" readOnly />
      <OTPField label="Masked" length={4} defaultValue="01" mask />
    </Box>
  );
}
```

## Controlled and uncontrolled values

The code is a single string, so a value like `"0123"` keeps its leading zero.
Use `defaultValue` for the initial code in an uncontrolled field. To control the field, pass `value` and update it in `onValueChange`. Use `''` for an empty code.

`onValueChange(code, details)` receives the proposed code. Use `details.reason` to distinguish typing, pasting, and deletion, or call `details.cancel()` to reject the change.

```tsx
import * as React from 'react';
import Box from '@mui/material/Box';
import OTPField from '@mui/material/OTPField';

export default function OTPFieldState() {
  const [code, setCode] = React.useState('01');

  return (
    <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 3 }}>
      <OTPField
        label="Controlled"
        length={4}
        value={code}
        onValueChange={setCode}
        helperText={`${code.length} of 4 digits entered`}
      />
      <OTPField label="Uncontrolled" length={4} defaultValue="01" />
    </Box>
  );
}
```

## Validation

Use `validationType` to accept digits (`numeric`, the default), letters A–Z and a–z (`alpha`), or both (`alphanumeric`). Choose `none` for a code with other characters.
The field strips whitespace, silently filters out unsupported characters, and limits the code to `length` characters. Use `inputMode` to choose the mobile keyboard independently.

To give feedback, use `onValueInvalid(attempt, details)` to set `error` and show a message with `helperText`. The callback receives the original typed or pasted text.
In this example, typing a letter leaves the code unchanged and displays a message. Enter a digit to clear the message.

```tsx
import * as React from 'react';
import OTPField from '@mui/material/OTPField';

export default function ValidationOTPField() {
  const [error, setError] = React.useState(false);

  return (
    <OTPField
      label="Device code"
      length={4}
      fullWidth
      sx={{ maxWidth: 256 }}
      error={error}
      helperText={
        error ? 'Use digits 0–9.' : 'Enter the four digits on your device.'
      }
      onValueInvalid={() => setError(true)}
      onValueChange={() => setError(false)}
    />
  );
}
```

### Grouped recovery code

Paste `ab1-cd2` into the first input. With `validationType="alphanumeric"`, the field drops the hyphen, then `normalizeValue` converts the letters to uppercase. The resulting value is `"AB1CD2"`.
When writing a normalizer, make sure applying it twice gives the same result as applying it once.

Place an `OTPFieldSeparator` between `OTPFieldInput` children to display the code as `AB1-CD2`. The separator displays a hyphen by default and accepts custom content as children.
Set `length` to the number of character inputs.

```tsx
import OTPField, { OTPFieldInput, OTPFieldSeparator } from '@mui/material/OTPField';

export default function GroupedOTPField() {
  return (
    <OTPField
      label="Recovery code"
      helperText="Enter the six characters on your recovery card."
      validationType="alphanumeric"
      normalizeValue={(value) => value.toUpperCase()}
    >
      <OTPFieldInput />
      <OTPFieldInput />
      <OTPFieldInput />
      <OTPFieldSeparator />
      <OTPFieldInput />
      <OTPFieldInput />
      <OTPFieldInput />
    </OTPField>
  );
}
```

## Sizes

Use `size="small"` for more compact character inputs. The default size is `medium`.

```tsx
import Box from '@mui/material/Box';
import OTPField from '@mui/material/OTPField';

export default function OTPFieldSizes() {
  return (
    <Box sx={{ display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: 3 }}>
      <OTPField label="Small" length={4} defaultValue="0123" size="small" />
      <OTPField label="Medium" length={4} defaultValue="0123" />
    </Box>
  );
}
```

## Color

The `color` prop changes the focused input's outline. The default is `primary`, and the `error` state takes precedence.
Focus an input in each field to see its color.

```tsx
import Box from '@mui/material/Box';
import OTPField from '@mui/material/OTPField';

export default function OTPFieldColors() {
  return (
    <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 3 }}>
      <OTPField label="Secondary" length={4} color="secondary" />
      <OTPField label="Success" length={4} color="success" />
    </Box>
  );
}
```

## Full width

Use `fullWidth` to fill the width of the field's container. The character inputs share the available space equally and separators keep their natural width.

```tsx
import Box from '@mui/material/Box';
import OTPField from '@mui/material/OTPField';

export default function FullWidthOTPField() {
  return (
    <Box sx={{ width: 500, maxWidth: '100%' }}>
      <OTPField label="Full width" fullWidth />
    </Box>
  );
}
```

## Form submission

Set `name` on `OTPField` to submit the whole code under one form key. For example, `name="pin"` lets the submit handler read `new FormData(form).get('pin')`.
If the field is outside the form, pass the form's `id` to the `form` prop.

Submit an incorrect four-digit PIN to see the error message and return focus to the first input. Then try the sample PIN `0012`.

```tsx
import * as React from 'react';
import Button from '@mui/material/Button';
import OTPField from '@mui/material/OTPField';
import Stack from '@mui/material/Stack';

const messages = {
  idle: 'Use the sample PIN 0012.',
  accepted: 'PIN accepted.',
  rejected: 'Incorrect PIN. Try 0012 again.',
};

export default function OTPFieldForm() {
  const [result, setResult] = React.useState<keyof typeof messages>('idle');
  const inputRef = React.useRef<HTMLInputElement>(null);

  function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
    event.preventDefault();
    const pin = new FormData(event.currentTarget).get('pin');
    if (pin === '0012') {
      setResult('accepted');
    } else {
      setResult('rejected');
      inputRef.current?.focus();
    }
  }

  return (
    <Stack
      component="form"
      onSubmit={handleSubmit}
      spacing={2}
      sx={{ width: 320, maxWidth: '100%', alignItems: 'flex-start' }}
    >
      <OTPField
        label="Verification PIN"
        name="pin"
        inputRef={inputRef}
        length={4}
        fullWidth
        required
        error={result === 'rejected'}
        helperText={<span role="status">{messages[result]}</span>}
        onValueChange={() => setResult('idle')}
      />
      <Button type="submit" variant="contained">
        Verify PIN
      </Button>
    </Stack>
  );
}
```

Use `onValueComplete(code, details)` to respond when the user finishes entering a code or pastes a complete one. Set `autoSubmit` to submit the associated form after this callback runs.

An uncontrolled field keeps its current code when the form resets, even if you supplied `defaultValue`.
For a [controlled field](#controlled-and-uncontrolled-values) that starts at `'01'`, set `onReset={() => setCode('01')}` on the form to restore that value.

## Customization

### Individual inputs

Pass native attributes, event handlers, or a ref directly to an `OTPFieldInput` child.
Use `slotProps.group` for the row that contains those inputs.

```jsx
import OTPField, { OTPFieldInput } from '@mui/material/OTPField';

<OTPField label="Check code" length={2} slotProps={{ group: { sx: { gap: 2 } } }}>
  <OTPFieldInput />
  <OTPFieldInput aria-label="Check digit" />
</OTPField>;
```

The field's `ref` points to the outer container. Use `inputRef` to focus the first input programmatically or `autoFocus` to focus it on mount.

### Rendering custom elements

Use `render` on `OTPField` to change its outer element and keep its Material styles and `FormControl` context.
The `group`, `label`, and `formHelperText` slots also accept `render` through `slotProps`.

A `slotProps` callback receives Material owner state such as `size` and `error`. A slot's `render(props, state)` callback receives live field state such as `complete`.
Spread the render callback's props onto the returned element and forward its ref. Both composed children also accept `render` directly. For `OTPFieldInput`, forward the props and ref to a native `<input>` to preserve focus, editing, and paste.

This example renders the outer element as a `<section>` and uses the helper text's render callback to announce when the code is complete.

```tsx
import OTPField from '@mui/material/OTPField';

export default function OTPFieldRender() {
  return (
    <OTPField
      label="Pairing code"
      length={4}
      helperText="Enter your device code."
      render={<section aria-label="Device pairing" />}
      slotProps={{
        formHelperText: {
          render: (props, state) => (
            <p {...props} role="status">
              {state.complete ? 'All four digits entered.' : props.children}
            </p>
          ),
        },
      }}
    />
  );
}
```

Use `slots` to replace an entire Material slot. A replacement takes precedence over `render` for that slot.
If you replace `slots.root`, forward its props and ref to a `FormControl` to keep its label and helper text in sync with the field state.
For outer spacing, use `sx` or set the `FormControl` margin through `slotProps.root.margin`. See the [available slots](/material-ui/api/otp-field/#slots).

### Theme overrides

Use `components.MuiOTPField.defaultProps` to set defaults across your app.
The `root`, `label`, `group`, and `formHelperText` keys in `styleOverrides` style the layout slots. Use `input` and `separator` to style the composed children.
For a CSS selector, use the corresponding class from `otpFieldClasses`, such as `otpFieldClasses.input` (`MuiOTPField-input`).
This theme sets the size to small, changes the focus color to secondary, and uses `styleOverrides.input` to round each character input.

```tsx
import OTPField from '@mui/material/OTPField';
import { ThemeProvider, useTheme } from '@mui/material/styles';
import type { Theme } from '@mui/material/styles';

const customTheme = (outerTheme: Theme): Theme => ({
  ...outerTheme,
  components: {
    ...outerTheme.components,
    MuiOTPField: {
      defaultProps: { size: 'small', color: 'secondary' },
      styleOverrides: {
        input: { borderRadius: '50%' },
      },
    },
  },
});

export default function OTPFieldTheme() {
  const outerTheme = useTheme();

  return (
    <ThemeProvider theme={customTheme(outerTheme)}>
      <OTPField
        label="Unlock code"
        length={4}
        helperText="Enter the four digits shown on your device."
      />
    </ThemeProvider>
  );
}
```

See [themed components](/material-ui/customization/theme-components/) for more details.

## Anatomy

The following tree shows a four-character field with a separator between the two pairs of inputs.

```text
root (FormControl)
├── label (FormLabel, optional)
├── group (div, role="group")
│   ├── OTPFieldInput (input)
│   ├── OTPFieldInput (input)
│   ├── OTPFieldSeparator (div, optional)
│   ├── OTPFieldInput (input)
│   └── OTPFieldInput (input)
└── formHelperText (FormHelperText, optional)
```

The `group` slot hosts the character inputs. A visually hidden input alongside the outer container submits the whole code as one form value.

## Accessibility

### Labels and descriptions

The group and first input share the field label. Clicking the label focuses the first input. When there is no visible label, set `aria-label` or `aria-labelledby` on `OTPField`.
Set `id` on `OTPField` to choose the first input's ID. The field generates one when omitted and links the label's `htmlFor` to it.
The helper text describes the group and each character input. Use `aria-describedby` on the field to add another description.
When customizing a label or helper, set its ID through `slotProps.label.id` or `slotProps.formHelperText.id` and forward the supplied attributes so these links stay intact.

Subsequent inputs announce their position, such as "Character 2 of 6." The [theme locale](/material-ui/guides/localization/#locale-text) supplies these labels.
Use `getAriaLabel(position, length)` to customize them for one field, or set `components.MuiOTPField.defaultProps.getAriaLabel` across your app. Positions start at one.
To name just one character after the first, pass `aria-label` to its `OTPFieldInput`.

### Keyboard and focus

The field is one tab stop. Typing advances focus, and pasting fills consecutive inputs from the current position.
Use the left and right arrow keys to move in the visual direction, <kbd>Home</kbd> to reach the first character, and <kbd>End</kbd> to reach the first empty input or the last input when the code is complete.
Press <kbd>Tab</kbd> or <kbd>Shift</kbd>+<kbd>Tab</kbd> to leave the field.

If the code should read left to right in a right-to-left form, set `dir` on the group so arrow-key navigation follows the displayed order.

```jsx
<OTPField label="Verification code" slotProps={{ group: { dir: 'ltr' } }} />
```


# FormControl API

## Demos

For examples and details on the usage of this React component, visit the component demo pages:

- [Checkbox](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-checkbox/)
- [Number Field](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-number-field/)
- [OTP Field](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-otp-field/)
- [Radio Group](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-radio-button/)
- [Switch](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-switch/)
- [Text Field](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-text-field/)

## Import

```jsx
import FormControl from '@mui/material/FormControl';
// or
import { FormControl } from '@mui/material';
```

## Props

| Name | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| children | `node` | - | No |  |
| classes | `object` | - | No | Override or extend the styles applied to the component. |
| color | `'primary' \| 'secondary' \| 'error' \| 'info' \| 'success' \| 'warning' \| string` | `'primary'` | No |  |
| component | `elementType` | - | No |  |
| disabled | `bool` | `false` | No |  |
| error | `bool` | `false` | No |  |
| focused | `bool` | - | No |  |
| fullWidth | `bool` | `false` | No |  |
| hiddenLabel | `bool` | `false` | No |  |
| margin | `'dense' \| 'none' \| 'normal'` | `'none'` | No |  |
| required | `bool` | `false` | No |  |
| size | `'medium' \| 'small' \| string` | `'medium'` | No |  |
| sx | `Array<func \| object \| bool> \| func \| object` | - | No | The system prop that allows defining system overrides as well as additional CSS styles. |
| variant | `'filled' \| 'outlined' \| 'standard'` | `'outlined'` | No |  |

> **Note**: The `ref` is forwarded to the root element (HTMLDivElement).

> Any other props supplied will be provided to the root element (native element).

## Theme default props

You can use `MuiFormControl` to change the default props of this component with the theme.

## CSS

### Rule name

| Global class | Rule name | Description |
|--------------|-----------|-------------|
| - | fullWidth | Styles applied to the root element if `fullWidth={true}`. |
| - | marginDense | Styles applied to the root element if `margin="dense"`. |
| - | marginNormal | Styles applied to the root element if `margin="normal"`. |
| - | root | Styles applied to the root element. |

## Source code

If you did not find the information on this page, consider having a look at the implementation of the component for more detail.

- [/packages/mui-material/src/FormControl/FormControl.js](https://github.com/mui/material-ui/tree/HEAD/packages/mui-material/src/FormControl/FormControl.js)

# FormHelperText API

## Demos

For examples and details on the usage of this React component, visit the component demo pages:

- [Number Field](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-number-field/)
- [OTP Field](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-otp-field/)
- [Text Field](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-text-field/)

## Import

```jsx
import FormHelperText from '@mui/material/FormHelperText';
// or
import { FormHelperText } from '@mui/material';
```

## Props

| Name | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| children | `node` | - | No |  |
| classes | `object` | - | No | Override or extend the styles applied to the component. |
| component | `elementType` | - | No |  |
| disabled | `bool` | - | No |  |
| error | `bool` | - | No |  |
| filled | `bool` | - | No |  |
| focused | `bool` | - | No |  |
| margin | `'dense'` | - | No |  |
| required | `bool` | - | No |  |
| sx | `Array<func \| object \| bool> \| func \| object` | - | No | The system prop that allows defining system overrides as well as additional CSS styles. |
| variant | `'filled' \| 'outlined' \| 'standard' \| string` | - | No |  |

> **Note**: The `ref` is forwarded to the root element (HTMLParagraphElement).

> Any other props supplied will be provided to the root element (native element).

## Theme default props

You can use `MuiFormHelperText` to change the default props of this component with the theme.

## CSS

### Rule name

| Global class | Rule name | Description |
|--------------|-----------|-------------|
| - | contained | Styles applied to the root element if `variant="filled"` or `variant="outlined"`. |
| `.Mui-disabled` | - | State class applied to the root element if `disabled={true}`. |
| `.Mui-error` | - | State class applied to the root element if `error={true}`. |
| - | filled | State class applied to the root element if `filled={true}`. |
| `.Mui-focused` | - | State class applied to the root element if `focused={true}`. |
| `.Mui-required` | - | State class applied to the root element if `required={true}`. |
| - | root | Styles applied to the root element. |
| - | sizeSmall | Styles applied to the root element if `size="small"`. |

## Source code

If you did not find the information on this page, consider having a look at the implementation of the component for more detail.

- [/packages/mui-material/src/FormHelperText/FormHelperText.js](https://github.com/mui/material-ui/tree/HEAD/packages/mui-material/src/FormHelperText/FormHelperText.js)

# FormLabel API

## Demos

For examples and details on the usage of this React component, visit the component demo pages:

- [Checkbox](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-checkbox/)
- [Number Field](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-number-field/)
- [OTP Field](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-otp-field/)
- [Radio Group](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-radio-button/)
- [Switch](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-switch/)

## Import

```jsx
import FormLabel from '@mui/material/FormLabel';
// or
import { FormLabel } from '@mui/material';
```

## Props

| Name | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| children | `node` | - | No |  |
| classes | `object` | - | No | Override or extend the styles applied to the component. |
| color | `'error' \| 'info' \| 'primary' \| 'secondary' \| 'success' \| 'warning' \| string` | - | No |  |
| component | `elementType` | - | No |  |
| disabled | `bool` | - | No |  |
| error | `bool` | - | No |  |
| filled | `bool` | - | No |  |
| focused | `bool` | - | No |  |
| required | `bool` | - | No |  |
| sx | `Array<func \| object \| bool> \| func \| object` | - | No | The system prop that allows defining system overrides as well as additional CSS styles. |

> **Note**: The `ref` is forwarded to the root element (HTMLLabelElement).

> Any other props supplied will be provided to the root element (native element).

## Theme default props

You can use `MuiFormLabel` to change the default props of this component with the theme.

## CSS

### Rule name

| Global class | Rule name | Description |
|--------------|-----------|-------------|
| - | asterisk | Styles applied to the asterisk element. |
| - | colorSecondary | Styles applied to the root element if the color is secondary. |
| `.Mui-disabled` | - | State class applied to the root element if `disabled={true}`. |
| `.Mui-error` | - | State class applied to the root element if `error={true}`. |
| - | filled | State class applied to the root element if `filled={true}`. |
| `.Mui-focused` | - | State class applied to the root element if `focused={true}`. |
| `.Mui-required` | - | State class applied to the root element if `required={true}`. |
| - | root | Styles applied to the root element. |

## Source code

If you did not find the information on this page, consider having a look at the implementation of the component for more detail.

- [/packages/mui-material/src/FormLabel/FormLabel.js](https://github.com/mui/material-ui/tree/HEAD/packages/mui-material/src/FormLabel/FormLabel.js)

# OTPField API

## Demos

For examples and details on the usage of this React component, visit the component demo pages:

- [OTP Field](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-otp-field/)

## Import

```jsx
import OTPField from '@mui/material/OTPField';
// or
import { OTPField } from '@mui/material';
```

## Props

| Name | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| aria-describedby | `string` | - | No |  |
| aria-label | `string` | - | No |  |
| aria-labelledby | `string` | - | No |  |
| autoComplete | `string` | `'one-time-code'` | No |  |
| autoFocus | `bool` | - | No |  |
| autoSubmit | `bool` | `false` | No |  |
| children | `node` | - | No |  |
| classes | `object` | - | No | Override or extend the styles applied to the component. |
| color | `'primary' \| 'secondary' \| 'error' \| 'info' \| 'success' \| 'warning' \| string` | `'primary'` | No |  |
| defaultValue | `string` | `''` | No |  |
| disabled | `bool` | - | No |  |
| error | `bool` | `false` | No |  |
| form | `string` | - | No |  |
| fullWidth | `bool` | `false` | No |  |
| getAriaLabel | `func` | `function defaultGetAriaLabel(position: number, length: number) {
  return `Character ${position} of ${length}`;
}` | No |  |
| helperText | `node` | - | No |  |
| id | `string` | - | No |  |
| inputMode | `'decimal' \| 'email' \| 'none' \| 'numeric' \| 'search' \| 'tel' \| 'text' \| 'url'` | - | No |  |
| inputRef | `func \| { current?: object }` | - | No |  |
| label | `node` | - | No |  |
| length | `number` | `6` | No |  |
| mask | `bool` | `false` | No |  |
| name | `string` | - | No |  |
| normalizeValue | `func` | - | No |  |
| onValueChange | `func` | - | No |  |
| onValueComplete | `func` | - | No |  |
| onValueInvalid | `func` | - | No |  |
| readOnly | `bool` | - | No |  |
| render | `element \| func` | - | No |  |
| required | `bool` | - | No |  |
| size | `'medium' \| 'small' \| string` | `'medium'` | No |  |
| slotProps | `{ formHelperText?: func \| object, group?: func \| object, label?: func \| object, root?: func \| object }` | - | No |  |
| slots | `{ formHelperText?: elementType, group?: elementType, label?: elementType, root?: elementType }` | - | No |  |
| sx | `Array<func \| object \| bool> \| func \| object` | - | No | The system prop that allows defining system overrides as well as additional CSS styles. |
| validationType | `'alpha' \| 'alphanumeric' \| 'none' \| 'numeric'` | `'numeric'` | No |  |
| value | `string` | - | No |  |

> **Note**: The `ref` is forwarded to the root element (HTMLDivElement).

> Any other props supplied will be provided to the root element (native element).

## Theme default props

You can use `MuiOTPField` to change the default props of this component with the theme.

## Slots

| Name | Default | Class | Description |
|------|---------|-------|-------------|
| root | `FormControl` | `.MuiOTPField-root` | The outer field container. |
| label | `FormLabel` | `.MuiOTPField-label` | The visible field label. |
| group | `'div'` | `.MuiOTPField-group` | The host for the character inputs and separators. |
| formHelperText | `FormHelperText` | `.MuiOTPField-formHelperText` | The supporting or error text. |

## CSS

### Rule name

| Global class | Rule name | Description |
|--------------|-----------|-------------|
| - | input | Styles applied to each character input. |
| - | separator | Styles applied to each decorative separator. |

## Source code

If you did not find the information on this page, consider having a look at the implementation of the component for more detail.

- [/packages/mui-material/src/OTPField/OTPField.tsx](https://github.com/mui/material-ui/tree/HEAD/packages/mui-material/src/OTPField/OTPField.tsx)

# OTPFieldInput API

## Demos

For examples and details on the usage of this React component, visit the component demo pages:

- [OTP Field](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-otp-field/)

## Import

```jsx
import OTPFieldInput from '@mui/material/OTPFieldInput';
// or
import { OTPFieldInput } from '@mui/material';
```

## Props

| Name | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| className | `func \| string` | - | No |  |
| render | `element \| func` | - | No |  |
| style | `func \| object` | - | No |  |
| sx | `Array<func \| object \| bool> \| func \| object` | - | No | The system prop that allows defining system overrides as well as additional CSS styles. |

> **Note**: The `ref` is forwarded to the root element.

> Any other props supplied will be provided to the root element (native element).

## Source code

If you did not find the information on this page, consider having a look at the implementation of the component for more detail.

- [/packages/mui-material/src/OTPFieldInput/OTPFieldInput.tsx](https://github.com/mui/material-ui/tree/HEAD/packages/mui-material/src/OTPFieldInput/OTPFieldInput.tsx)

# OTPFieldSeparator API

## Demos

For examples and details on the usage of this React component, visit the component demo pages:

- [OTP Field](https://deploy-preview-49936--material-ui.netlify.app/material-ui/react-otp-field/)

## Import

```jsx
import OTPFieldSeparator from '@mui/material/OTPFieldSeparator';
// or
import { OTPFieldSeparator } from '@mui/material';
```

## Props

| Name | Type | Default | Required | Description |
|------|------|---------|----------|-------------|
| aria-hidden | `'false' \| 'true' \| bool` | `true` | No |  |
| children | `node` | `'-'` | No |  |
| className | `func \| string` | - | No |  |
| orientation | `'horizontal' \| 'vertical'` | `'vertical'` | No |  |
| render | `element \| func` | - | No |  |
| style | `func \| object` | - | No |  |
| sx | `Array<func \| object \| bool> \| func \| object` | - | No | The system prop that allows defining system overrides as well as additional CSS styles. |

> **Note**: The `ref` is forwarded to the root element.

> Any other props supplied will be provided to the root element (native element).

## Source code

If you did not find the information on this page, consider having a look at the implementation of the component for more detail.

- [/packages/mui-material/src/OTPFieldSeparator/OTPFieldSeparator.tsx](https://github.com/mui/material-ui/tree/HEAD/packages/mui-material/src/OTPFieldSeparator/OTPFieldSeparator.tsx)