Use for entering a short one-time verification code.
Use state to move the one-time password component through its verification workflow. Leave it unset for the default input state.
ready shows the Send code button and hides the OTP fields until the user clicks it. Clicking the button focuses the OTP input, clears state, and emits tctSendCode.verifying locks the OTP input and shows the processing label.error shows the error message. When clear-on-error is set, the fields are cleared as the component enters this state.success locks the OTP input and shows the success message.The q2-otp element has one or more properties that support text localization. Those properties are indicated by the localizable badge in the description.
autoFocusauto-focusFocuses the first one-time password field when the component loads.
autoSubmitauto-submitTriggers submission when the last field is filled.
clearOnErrorclear-on-errorClears all fields and returns focus to the first field when state becomes error.
disabledDisables all one-time password fields.
errorMessageerror-messageError message rendered below the submit area.
helperTexthelper-textHelper text content.
labelVisible label above the one-time password fields.
lengthNumber of one-time password fields.
maskedObscures entered characters.
processingLabelprocessing-labelButton text during processing.
sendCodeLabelsend-code-labelButton text for the send-code action.
showHelperTextshow-helper-textToggles helper text visibility.
stateSets the visual status for the one-time password fields.
ready — Shows the send-code button and hides the input fields until the user requests a code.error — Displays an error style on the fields. If errorMessage is set, it renders below the submit area.
When clearOnError is enabled, all fields are cleared and focus returns to the first field.success — Locks the input, replaces the submit button with a success indicator, and displays the
successMessage if provided.verifying — Locks the input and puts the submit button into a loading state. When combined with autoSubmit,
a processing overlay with processingLabel is shown over the fields.submitLabelsubmit-labelRenders a submit button with this label.
successMessagesuccess-messageSuccess message rendered below the submit area.
valueThe composed one-time password value.
The q2-otp element exposes events that can be used to send and receive data from the component based on user interaction.
Emitted when the fields are cleared.
{ value: string; }Emitted when all fields are filled.
{ value: string; }Emitted when any field value changes.
{ value: string; }Emitted when the send-code button is clicked.
voidEmitted when the submit button is clicked or auto-submit triggers.
{ value: string; }The q2-otp element exposes methods that can be used to perform various actions on the component.
Clears all fields, focuses the first field, and emits tctClear.
clear() => Promise<void>Clears the component and resets error, success, and processing state.
reset() => Promise<void>The following CSS variables are available to override the default theme styles of the q2-otp component.
Many Tecton components consume other components to maintain visual and functional consistency. If you are looking for a CSS variable you think should exist but are not seeing it, it may be defined in one of the dependent components below. Either way, if you think it's something we should expose more conveniently, let us know!
The changelog provides a detailed history of new features, improvements, and bug fixes going back to Tecton 1.30.0. If the button is disabled, it indicates there have been no detectable changes since then.