Zustände
Auswahl mit Platzhalter, Fehler, Erfolg, deaktiviert und schreibgeschützt.
Formulare
Custom select (Figma: Select) that looks the same in every browser: form-associated <tc-select> with a button-like trigger and a listbox popup in the top layer (also inside dialogs and drawers), keyboard per the APG select-only combobox pattern (arrows, Home/End, typeahead, Escape, Tab). Options come from options= (Django choices incl. groups, dictionaries or "value=Label|...") or from <option>/<optgroup> markup in the default slot; they stay light children. The selected label is rendered on the server. Multiple selection shows removable tags (max_tags, rest as "+n"); prefix/suffix slots or icon/icon_right add content before and after the value. Use Combobox when users need to filter long lists. Events: change, tc-change, tc-show, tc-hide, tc-clear.
Auswahl mit Platzhalter, Fehler, Erfolg, deaktiviert und schreibgeschützt.
SM 28, MD 36 und LG 44 px; auch das geöffnete Auswahl-Popup wächst mit (Zeilenhöhe, Schrift, Abstände).
entfernbare Tags (max_tags, Rest als „+n“), Löschen-Button, Backspace entfernt den letzten Wert; in den Größen SM, MD und LG, darunter rohes HTML.
optgroup-Kinder erscheinen als Gruppenüberschriften im Listbox-Popup; oben Template-Tag mit Django-Choices-Gruppen, unten rohes HTML.
icon/icon_right als tc-icon oder eigene Inhalte in den Slots prefix/suffix; oben Template-Tags, unten rohes HTML.
das Auswahl-Popup liegt in der Top-Layer-Ebene und wird vom Dialog nicht abgeschnitten.
tc-select mit option-Kindern; Optionen dürfen per HTMX ausgetauscht werden, die Auswahl bleibt erhalten.
| 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: Django choices, dictionaries or "value=Label|value=Label". |
multiple | False | – | Allow several values (value as list or "a,b"); the popup stays open. |
rows | 0 | – | Visible option rows in the popup before it scrolls (default 8). |
clearable | False | – | Show a clear button while a value is selected. |
max_tags | 3 | – | Multiple: tags shown in the field; the rest is summarised as "+n". |
placement | 'bottom' | Preferred popup side; flips when there is not enough space. | |
icon | '' | – | Leading Carbon icon (prefix), e.g. "location". |
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. |
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.