UNPKG

@julo-ui/otp-input

Version:

React Input Component for entering sequences of digits

19 lines (16 loc) 493 B
import { useOtpInputContext } from "./chunk-BPNQAI6D.mjs"; import { useOtpInputDescendant } from "./chunk-7F2N6GEZ.mjs"; // src/components/otp-input-field/use-otp-input-field.ts import { mergeRefs } from "@julo-ui/dom-utils"; function useOtpInputField(props, ref = null) { const { getInputProps } = useOtpInputContext(); const { index, register } = useOtpInputDescendant(); return getInputProps({ ...props, ref: mergeRefs(register, ref), index }); } export { useOtpInputField };