Übersicht FarbenTypografieAbstände & RasterIcons ButtonButton GroupIcon ButtonLink CheckboxCheckbox GroupChipChip GroupComboboxDate PickerFieldField LabelFieldsFile UploadFormForm SectionInputInput GroupOTP InputPasswordRadioRadio GroupRange SliderReset ButtonSave ButtonSearchSegmented ControlSelectSliderSwitchTextareaTime Picker AvatarAvatar GroupBadgeChartCode BlockCopy ValueData TableInline StatKey ValueList GroupList RowsMeta ItemQR CodeStatStat StripTableTag AlertEmpty StateGuideLive StatusMessagesProgressSkeletonToast DialogDrawerDropdownMenuMenu ItemPopoverTooltip BreadcrumbContent NavigationDate NavigationPaginationSidebarStepperTabsTheme SwitchTopbar AccordionAccordion ItemApp ShellCardDividerFooterPage HeaderSection HeaderSplit Panel DashboardListeFormularDetailansichtEinstellungenMehrschritt-AssistentLeerer StartLoginFehlerseite IconsMusterAdmin

OTP Input

Zustände

Bestätigungscode leer, teilweise, Fehler, Erfolg, maskiert und deaktiviert.

Code<div class="tc-stack" style="--tc-gap: 24px"> {% tc_otp_input# label="Bestätigungscode" name="code" help="Code aus der Authenticator-App" %} {% tc_otp_input# label="Bestätigungscode" name="code_partial" value="48" help="Code aus der Authenticator-App" %} {% tc_otp_input# label="Bestätigungscode" name="code_error" value="481920" error="Code ungültig oder abgelaufen." %} {% tc_otp_input# label="Bestätigungscode" name="code_success" value="481920" state="success" help="Code bestätigt." %} {% tc_otp_input# label="PIN" name="pin" value="4819" length=4 masked=True separator=False %} {% tc_otp_input# label="Bestätigungscode" name="code_disabled" disabled=True %} </div>

Größen

Zellen in SM, MD und LG sowie ein alphanumerischer Code.

Code<div class="tc-stack" style="--tc-gap: 24px"> {% tc_otp_input# label="Code (SM)" name="code_sm" size="sm" value="48" %} {% tc_otp_input# label="Code (MD)" name="code_md" value="48" %} {% tc_otp_input# label="Code (LG)" name="code_lg" size="lg" value="48" %} {% tc_otp_input# label="Wiederherstellungscode" name="recovery" numeric=False length=8 help="Buchstaben und Ziffern" %} </div>

Ereignis tc-complete

feuert, sobald alle Zellen gefüllt sind (z. B. zum automatischen Absenden).

Status: wartet

Code<div class="tc-stack" style="--tc-gap: 12px"> <tc-otp-input name="api_code" label="Bestätigungscode" length="6" separator help="Code aus der Authenticator-App"></tc-otp-input> <p class="tc-text-body-sm tc-text-secondary">Status: <span class="tc-mono">wartet</span></p> <script> (function (root) { root.querySelector('tc-otp-input').addEventListener('tc-complete', event => { root.querySelector('.tc-mono').textContent = 'vollständig: ' + event.detail.value; }); })(document.currentScript.parentElement); </script> </div>

API

OptionStandardWerteBeschreibung
label''–Visible label text.
requiredFalse–Mark as required: native required attribute plus a red asterisk.
optionalFalse–Show the "optional" marker after the label (ignored when required).
label_icon''–Explanation shown as a help icon with tooltip after the label.
hide_labelFalse–Keep the label for assistive technology only.
help''–Hint below the control (Figma: Hint / Help Text).
error''–Error message or list of messages (e.g. Django field.errors); sets the error state, aria-invalid and aria-describedby. Replaces the hint while shown.
state''Validation state without an error message: success or warning colour the border and the hint.
name''–Form field name (Django html_name).
value'None'–Current value; dates and numbers are converted to their ISO/text form.
disabledFalse–Disable the control.
readonlyFalse–Read-only: value stays selectable and is submitted.
size'md'Height: sm 28, md 36, lg 44 px (match the buttons in the same row).
length6–Number of cells.
separatorTrue–Show a dash in the middle (Figma: Show Separator).
maskedFalse–Hide the characters like a password.
numericTrue–Digits only (numeric keyboard); False also accepts letters.

Verwendung

{% load components tomcom_theme %} {% tc_otp_input label="…" required="…" %}…{% endtc_otp_input %} {% tc_otp_input# %} {# inline form without content #}

Zusätzliche Attribute (z. B. class, aria-*, data-*) und HTMX-Kurzformen (get, post, get_url, post_url, target, swap, trigger, confirm) werden an das Element „root“ durchgereicht.