{#- chirp-ui: Input OTP Grouped one-time-code input fields with paste, backspace, and arrow-key navigation. Emits `chirpui:otp-change` with {value} as digits are entered. A hidden input carries the composed value for form posts. Usage: from "chirpui/input_otp.html" import input_otp {{ input_otp("otp", length=6, label="Verification code") }} -#} {% def input_otp(name, length=6, label=none, id=none, cls="", autocomplete="one-time-code") %} {% set _length = length if length > 0 else 6 %} {% set _id = id or ("chirpui-otp-" ~ name) %}
{% if label %} {% endif %}
{% for i in range(_length) %} {% endfor %}
{% end %}