Ü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

Field

Verwendung

einzelne Felder eines Django-Formulars an beliebiger Stelle; Name, ID, Wert, Label, Hilfetext und Pflicht kommen aus dem Formular.

Code{% comment %} forms.py class BookingForm(forms.Form): project = forms.ChoiceField(label='Kunde / Projekt', choices=…) … views.py form = BookingForm(request.POST or None, initial={'date': date.today()}) template {% tc_field# field=form.project %} {% endcomment %} {% demo_form as form %} <div class="tc-stack" style="--tc-gap:20px;max-width:560px"> {% tc_field# field=form.project %} {% tc_field# field=form.ticket %} {% tc_field# field=form.description %} </div>

Widgets

jedes Django-Widget wird zum passenden tc-Element – Select, Radio- und Checkbox-Gruppe, Checkbox, Datum, Uhrzeit und Zahl.

Code{% demo_form as form %}{% demo_form "work" as work %}{% demo_form "notify" as notify %}{% demo_form "period" as period %} <div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr));gap:20px 24px;align-items:start"> {% tc_field# field=form.module %} {% tc_field# field=form.date %} {% tc_field# field=work.core_start %} {% tc_field# field=work.weekly_hours %} {% tc_field# field=work.rounding %} {% tc_field# field=form.location %} {% tc_field# field=period.kind %} {% tc_field# field=work.workdays %} {% tc_field# field=notify.daily_reminder %} </div>

Überschreiben

Label, Hilfetext, Größe, Monospace und Spaltenbreite je Feld; weitere Attribute (hx-*, data-*) landen am Element.

Code{% demo_form as form %} <div class="tc-stack" style="--tc-gap:20px;max-width:560px"> {% tc_field# field=form.ticket label="Ticket" help="Optional – ohne Ticket wird nur auf das Projekt gebucht." size="sm" %} {% tc_field# field=form.duration size="lg" help="Stunden:Minuten, z. B. 1:30" %} {% tc_field# field=form.note mono=True help="" %} {% tc_field# field=form.project hx-get="/beispiel/poms/projekt/" hx-trigger="tc-change" hx-swap="none" %} </div>

Fehler

ein gebundenes Formular zeigt Django-Fehler direkt am Feld (role=alert, aria-describedby); Formularfehler zeigt tc_fields als Zusammenfassung.

Code{% demo_form invalid=True as form %} <div class="tc-stack" style="--tc-gap:20px;max-width:560px"> {% tc_field# field=form.description %} {% tc_field# field=form.duration %} </div>

API

OptionStandardWerteBeschreibung
field'None'–Bound field, e.g. form.hostname (required).
label''–Override the field label.
help'None'–Override the help text.
size'md'Control size.
monoFalse–Monospaced value (text inputs and textarea).
wide'None'–Span both columns of a two-column form (default for textareas and groups).

Verwendung

{% load components tomcom_theme %} {% tc_field field="…" label="…" %}…{% endtc_field %} {% tc_field# %} {# 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.