Einzelauswahl
filterbare Liste mit Kundennummern, Pflichtfeld, Hilfetext, Löschen und Fehler.
Formulare
Selection from long lists with a filter field in the popup (Figma: Combobox, Mode Single|Multi), form-associated <tc-combobox>. Keyboard: Enter/Space/ArrowDown open, arrows move, Enter selects, Escape closes; typing on the closed field starts the search, Backspace removes the last value. The popup lives in the top layer (dialogs, drawers). Multiple shows removable tags (max_tags, rest "+n"); prefix/suffix slots or icon/icon_right frame the value. Options are light <option> children and may carry data-code (mono prefix such as a customer number) and optgroups. With options_url the list is fetched while typing (GET <url>?q=…; respond with {% tc_combobox_options# %}). Events: change, tc-change, tc-select, tc-show, tc-hide.
filterbare Liste mit Kundennummern, Pflichtfeld, Hilfetext, Löschen und Fehler.
SM, MD und LG – Feld, Tags der Mehrfachauswahl und Popup wachsen mit.
Optionen werden beim Tippen per HTMX geladen (GET ?q=…), die Auswahl bleibt erhalten.
show(), value und das Ereignis tc-select; Optionen sind option-Kinder mit data-code.
Auswahl: –
Tippen im geschlossenen Feld öffnet die Liste und filtert sofort, mit Trefferzahl, Gruppen und Leer-Zustand; oben Template-Tag, unten rohes HTML.
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.
optgroup-Kinder werden zu Gruppenüberschriften; die Suche filtert über alle Gruppen und blendet leere Gruppen aus; einfach und mit Mehrfachauswahl.
| Option | Standard | Werte | Beschreibung |
|---|---|---|---|
label | '' | – | Visible label text. |
required | False | – | Mark as required: native required attribute plus a red asterisk. |
optional | False | – | Show the "optional" marker after the label (ignored when required). |
label_icon | '' | – | Explanation shown as a help icon with tooltip after the label. |
hide_label | False | – | 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. |
disabled | False | – | Disable the control. |
readonly | False | – | 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". |
multiple | False | – | 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. |
clearable | False | – | Show a clear button while a value is selected. |
max_tags | 3 | – | 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. |
pill | False | – | Fully rounded field and tags. |
{% slot prefix %} | – | Slot | Benannter Inhaltsbereich. |
{% slot suffix %} | – | Slot | Benannter Inhaltsbereich. |
<option> elements for a combobox options_url response.
| Option | Standard | Werte | Beschreibung |
|---|---|---|---|
options | '()' | – | Options, see tc_combobox. |
value | 'None' | – | Selected value(s). |
multiple | False | – | Split string values on commas. |
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.