Ü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

Combobox

Einzelauswahl

filterbare Liste mit Kundennummern, Pflichtfeld, Hilfetext, Löschen und Fehler.

Code<div class="tc-stack" style="--tc-gap: 20px; max-width: 320px"> {% tc_combobox# label="Kunde" name="customer" value="k42" clearable=True help="Suche nach Name oder Kundennummer." search_placeholder="Kunde suchen" empty_text="Keine Treffer für „%s“" options="k42=Muster GmbH|k107=Mustermann AG|k233=Musterhaus KG|k318=Musterbau GmbH|k402=Mustertechnik AG|k515=Beispiel & Partner" %} {% tc_combobox# label="Projekt" name="project" required=True error="Bitte ein Projekt auswählen." placeholder="Projekt wählen" options="p1=Relaunch Website|p2=Intranet|p3=Monitoring" %} {% tc_combobox# label="Abteilung" name="department" optional=True value="dev" options="dev=Entwicklung|ops=Betrieb|sales=Vertrieb" %} {% tc_combobox# label="Abteilung" name="department_disabled" value="dev" disabled=True options="dev=Entwicklung|ops=Betrieb" %} </div>

Größen

SM, MD und LG – Feld, Tags der Mehrfachauswahl und Popup wachsen mit.

Code<div class="tc-stack" style="--tc-gap: 20px; max-width: 400px"> {% tc_combobox# label="Kunde (SM)" name="customer_sm" size="sm" value="k42" options="k42=Muster GmbH|k107=Mustermann AG" %} {% tc_combobox# label="Kunde (MD)" name="customer_md" value="k42" options="k42=Muster GmbH|k107=Mustermann AG" %} {% tc_combobox# label="Kunde (LG)" name="customer_lg" size="lg" value="k42" options="k42=Muster GmbH|k107=Mustermann AG" %} {% tc_combobox# label="Kunden (SM)" name="customers_sm" size="sm" multiple=True max_tags=2 value="k42,k107,k233" options="k42=Muster GmbH|k107=Mustermann AG|k233=Musterhaus KG|k318=Musterbau GmbH|k402=Mustertechnik AG" placeholder="Kunden wählen" %} {% tc_combobox# label="Kunden (MD)" name="customers_md" multiple=True max_tags=2 value="k42,k107,k233" options="k42=Muster GmbH|k107=Mustermann AG|k233=Musterhaus KG|k318=Musterbau GmbH|k402=Mustertechnik AG" placeholder="Kunden wählen" %} {% tc_combobox# label="Kunden (LG)" name="customers_lg" size="lg" multiple=True max_tags=2 value="k42,k107,k233" options="k42=Muster GmbH|k107=Mustermann AG|k233=Musterhaus KG|k318=Musterbau GmbH|k402=Mustertechnik AG" placeholder="Kunden wählen" %} </div>

Serverseitige Suche

Optionen werden beim Tippen per HTMX geladen (GET ?q=…), die Auswahl bleibt erhalten.

Code<div style="max-width: 320px"> {% tc_combobox# label="Benutzer" name="user" value="max" options="max=Max Mustermann|erika=Erika Musterfrau" options_url="/beispiel/benutzer/suche/" search_placeholder="Name oder E-Mail" help="Mindestens zwei Zeichen eingeben." %} </div>

JavaScript-API

show(), value und das Ereignis tc-select; Optionen sind option-Kinder mit data-code.

Auswahl: –

Code<div class="tc-stack" style="--tc-gap: 12px; max-width: 320px; min-height: 320px"> <tc-combobox name="api_customer" label="Kunde" placeholder="Kunde wählen" search-placeholder="Kunde suchen" clearable> <option value="k42" data-code="K-0042">Muster GmbH</option> <option value="k107" data-code="K-0107">Mustermann AG</option> <optgroup label="Archiv"><option value="k233" data-code="K-0233">Musterhaus KG</option></optgroup> </tc-combobox> <div class="tc-cluster"> {% tc_button# variant="outlined" size="sm" label="Öffnen" data-demo="open" %} {% tc_button# variant="outlined" size="sm" label="K-0107 wählen" data-demo="pick" %} </div> <p class="tc-text-body-sm tc-text-secondary">Auswahl: <span class="tc-mono">–</span></p> <script> (function (root) { const box = root.querySelector('tc-combobox'); const out = root.querySelector('.tc-mono'); box.addEventListener('tc-change', () => { out.textContent = JSON.stringify(box.value); }); root.querySelector('[data-demo="open"]').addEventListener('click', () => box.show()); root.querySelector('[data-demo="pick"]').addEventListener('click', () => { box.value = 'k107'; out.textContent = JSON.stringify(box.value); }); })(document.currentScript.parentElement); </script> </div>

Mehrfachauswahl

Checkbox-Liste mit Suche, entfernbare Tags (max_tags, Rest „+n“), „Alle Treffer wählen“, Backspace entfernt den letzten Wert; oben Template-Tag, unten rohes HTML.

Code<div class="tc-stack" style="--tc-gap: 20px; max-width: 380px"> {% tc_combobox# label="Kunden" name="multi_customers" multiple=True clearable=True max_tags=2 value="k42,k107,k233" placeholder="Kunden wählen" options="k42=Muster GmbH|k107=Mustermann AG|k233=Musterhaus KG|k318=Musterbau GmbH|k402=Mustertechnik AG" %} <tc-combobox name="multi_tags" label="Schlagwörter" multiple clearable max-tags="3" placeholder="Schlagwörter wählen" search-placeholder="Schlagwort suchen"> <option value="vpn" selected>VPN</option> <option value="dns" selected>DNS</option> <option value="mail">Mail</option> <option value="backup">Backup</option> <option value="legacy" disabled>Legacy (gesperrt)</option> <tc-icon slot="prefix" name="tag" aria-hidden="true"></tc-icon> </tc-combobox> </div>

Optionsgruppen

optgroup-Kinder werden zu Gruppenüberschriften; die Suche filtert über alle Gruppen und blendet leere Gruppen aus; einfach und mit Mehrfachauswahl.

Code<div class="tc-stack" style="--tc-gap: 20px; max-width: 400px"> {% tc_combobox label="Standort" name="site_group" placeholder="Standort suchen" %} <optgroup label="Deutschland"> <option value="muc" data-code="MUC">München</option> <option value="ber" data-code="BER" selected>Berlin</option> <option value="ham" data-code="HAM">Hamburg</option> </optgroup> <optgroup label="Österreich"> <option value="vie" data-code="VIE">Wien</option> <option value="grz" data-code="GRZ" disabled>Graz (geschlossen)</option> </optgroup> <optgroup label="Schweiz"> <option value="zrh" data-code="ZRH">Zürich</option> </optgroup> {% endtc_combobox %} <tc-combobox name="servers_group" label="Server (rohes HTML)" multiple clearable placeholder="Server suchen"> <optgroup label="Produktion"> <option value="web-01" selected>web-01.example.com</option> <option value="web-02" selected>web-02.example.com</option> <option value="db-01">db-01.example.com</option> </optgroup> <optgroup label="Staging"> <option value="stage-01">stage-01.example.com</option> <option value="stage-db">stage-db.example.com</option> </optgroup> </tc-combobox> </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.
placeholder''–Placeholder text (never a replacement for the label).
size'md'Height: sm 28, md 36, lg 44 px (match the buttons in the same row).
options'()'–Options: dictionaries (value, label, code, group, disabled), Django choices or "value=Label|value=Label".
multipleFalse–Multi selection with checkboxes and tags (value as list or "a,b").
options_url''–Endpoint returning <option> markup for the query parameter q.
search_placeholder''–Placeholder of the filter field.
empty_text''–Message when nothing matches; %s is replaced by the query.
clearableFalse–Show a clear button while a value is selected.
max_tags3–Tags shown in the field (multi); the rest is summarised as "+n".
placement'bottom'Preferred popup side; flips when there is not enough space.
icon''–Leading Carbon icon (prefix).
icon_right''–Trailing Carbon icon (suffix) before the chevron.
pillFalse–Fully rounded field and tags.
{% slot prefix %}–SlotBenannter Inhaltsbereich.
{% slot suffix %}–SlotBenannter Inhaltsbereich.

Combobox Options

OptionStandardWerteBeschreibung
options'()'–Options, see tc_combobox.
value'None'–Selected value(s).
multipleFalse–Split string values on commas.

Verwendung

{% load components tomcom_theme %} {% tc_combobox label="…" required="…" %}…{% endtc_combobox %} {% tc_combobox# %} {# 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.