@pallas-ui/input-otp
v0.1.0
Published
An accessible one-time-password input component built on top of [input-otp](https://input-otp.rodz.dev/)
Readme
Input OTP
An accessible one-time-password input component built on top of input-otp
Features
- Variants based on style, shape and size that can be customized
- Validation state based styling for each variant
- Support for copy-paste and keyboard navigation
- TypeScript support
Installation
npm install @your-scope/input-otpUsage
import InputOTP from '@your-scope/input-otp'
function Example() {
return (
<InputOTP.Root maxLength={6}>
<InputOTP.Group>
<InputOTP.Slot index={0} />
<InputOTP.Slot index={1} />
<InputOTP.Slot index={2} />
</InputOTP.Group>
<InputOTP.Separator />
<InputOTP.Group>
<InputOTP.Slot index={3} />
<InputOTP.Slot index={4} />
<InputOTP.Slot index={5} />
</InputOTP.Group>
</InputOTP.Root>
)
}Components
InputOTP.Root- The root elementInputOTP.Group- The group wrapper elementInputOTP.Slot- The input slot elementInputOTP.Separator- A separator element
Accessibility
The component follows WAI-ARIA patterns for slots navigation:
- Includes proper ARIA labels for accessibility
- Maintains keyboard navigation support
- Maintains copy-paste support
License
MIT
