Skip to content

One-time code input

OTP-friendly text input with autocomplete="one-time-code".

from almasix.orbit.forms import Form, OneTimeCodeInput
form = Form.make("demo").schema([
OneTimeCodeInput.make("code")
.label("Verification code")
.required()
.max_length(6)
])
from almasix.orbit import Resource
from almasix.orbit.forms import Form, OneTimeCodeInput
class PostResource(Resource):
@classmethod
def form(cls, form: Form) -> Form:
return form.schema([
OneTimeCodeInput.make("otp").required().max_length(6),
OneTimeCodeInput.make("backup_code").helper_text("From your recovery list"),
])
  • Inherits TextInput; autocomplete defaults to one-time-code``
  • .max_length(n) / .required()
  • .autocomplete(...) to override
  • .disabled(...) / .visible(...)

Closures work on .label(), .helper_text(), .placeholder(), .visible(), .disabled(), and .required() — see Form closures.

Orbit form example (light)

Orbit form example (dark)