Ü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

File Upload

Zustände

Ablagefläche in Standard, Fehler, Laden, Limit und deaktiviert.

Code<div class="tc-stack" style="--tc-gap: 20px; max-width: 480px"> {% tc_file_upload# label="Befund" name="report" accept=".pdf,application/pdf" instruction="PDF hierher ziehen oder" action="Datei auswählen" help="PDF oder PDF/A · max. 50 MB" max_size=52428800 drop_text="Loslassen zum Hochladen" %} {% tc_file_upload# name="report_error" instruction="PDF hierher ziehen oder" action="Datei auswählen" error="Datei zu groß: bericht.pdf hat 62 MB, erlaubt sind 50 MB." %} {% tc_file_upload# name="report_loading" loading=True loading_text="Dateien werden geprüft …" help="PDF oder PDF/A · max. 50 MB" %} {% tc_file_upload# name="report_disabled" instruction="PDF hierher ziehen oder" action="Datei auswählen" help="PDF oder PDF/A · max. 50 MB" disabled=True %} </div>

Größen

Ablageflächen in SM (ohne Icon), MD und LG.

Code<div class="tc-stack" style="--tc-gap: 20px; max-width: 480px"> {% tc_file_upload# name="file_sm" size="sm" instruction="Datei hierher ziehen oder" action="auswählen" help="max. 10 MB" %} {% tc_file_upload# name="file_md" instruction="Datei hierher ziehen oder" action="auswählen" help="max. 10 MB" %} {% tc_file_upload# name="file_lg" size="lg" instruction="Dateien hierher ziehen oder" action="auswählen" help="Bis zu 5 Dateien, je max. 10 MB" multiple=True %} </div>

Dateiliste

Upload mit Fortschritt, erfolgreich geprüfte Datei und Fehler als tc-file-upload-item.

Code<div style="max-width: 480px"> {% tc_file_upload label="Anhänge" name="attachments" multiple=True instruction="PDF hierher ziehen oder" action="Datei auswählen" help="PDF oder PDF/A · max. 50 MB" %} {% tc_file_upload_item# name="Dokument_0001.pdf" status="uploading" progress=58 detail="1,4 von 2,4 MB" %} {% tc_file_upload_item# name="Dokument_0002.pdf" status="done" detail="2,4 MB · geprüft, PDF/A-2b" %} {% tc_file_upload_item# name="Dokument_0003.pdf" status="error" detail="Konvertierung fehlgeschlagen: Schriften nicht eingebettet" %} {% endtc_file_upload %} </div>

Rohes HTML

tc-file-upload sendet die Dateien als Formularwert (multipart); vorhandene Dateien als tc-file-upload-item.

Code<div style="max-width: 480px"> <tc-file-upload name="documents" label="Unterlagen" multiple max-files="3" accept=".pdf" instruction="PDF hierher ziehen oder" action="Datei auswählen" help="Bis zu 3 PDF-Dateien" remove-label="%s entfernen"> <tc-file-upload-item name="Vertrag_0001.pdf" status="done" detail="1,2 MB" icon="document--pdf" removable remove-label="Vertrag_0001.pdf entfernen"></tc-file-upload-item> </tc-file-upload> </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'file'–Form field name.
multipleFalse–Allow several files.
accept''–Accepted types, e.g. ".pdf,application/pdf".
instruction''–Drop instruction, default "Drag files here or".
action''–Link text that opens the file dialog, default "choose file".
drop_text''–Text while dragging over the zone, default "Release to upload".
size'md'Zone height: sm 88 (no icon), md 136, lg 200 px.
icon'upload'–Carbon icon in the zone.
disabledFalse–Disable the upload.
loadingFalse–Show the processing state (spinner) instead of the instruction.
loading_text''–Text of the processing state, default "Checking files …".
max_files0–Maximum number of files; the zone is locked when reached (0 = no limit).
max_size0–Maximum size per file in bytes, checked in the browser (0 = no limit).
upload_url''–Endpoint for immediate uploads with progress (POST, multipart).
files'()'–Existing files: dictionaries with name, size, status, detail, progress.

File Upload Item

OptionStandardWerteBeschreibung
name'Dokument.pdf'–File name.
size''–Size in bytes or preformatted text.
status'done'Uploading (progress bar), done or error.
detail''–Detail line, e.g. a validation result or error message.
progress0–Upload progress in percent.
url''–Link to the stored file.
removableTrue–Show the remove button.
input_name''–Name of a hidden input that keeps the stored file reference.
value''–Value of the hidden input (e.g. the stored file id).

Verwendung

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