Theme: ← Übersicht Tokens

Datei-Upload (Dropzone)

Lokale Dateiauswahl mit Dropzone oder Composer-Overlay, entfernbaren Dateikarten und optionalen Bild-, PDF-, Audio-, Video- und Textvorschauen. Ohne uploadUrl kein eigener Serverupload; v1.3 (opt-in): uploadUrl sendet die Dateien einzeln an einen Endpunkt gleicher Herkunft. v1.4 (opt-in): name/requi

Components v1.10.0 Formulare WebsiteAppDesktop component.file-upload

Nutzt: ui.icon ui.featured-icon ui.button ui.progress

Beispiele

Dropzone (klicken oder Dateien hineinziehen)
Anhänge
    Profilbild mit Zuschnitt (crop)
    Profilbild

      Eigenschaften

      PropTypDefaultBuilder-Label
      cropobject——
      labelstring""Label
      hintstring"PNG, JPG oder PDF (max. 10 MB)"Format-Hinweis
      multiplebooleantrueMehrere Dateien
      acceptstring""accept-Attribut (z.B. image/*,.pdf)
      capturestring: | user | environment""Kamera am Handy (capture)
      spacingstring: default | none | sm | md | lg | xl"default"Eigenabstand
      paddingstring: standard | none | sm | md | lg | xl"standard"Innenabstand (standard = Baustein-Wert)
      marginstring: standard | none | sm | md | lg | xl"standard"Aussenabstand
      borderstring: standard | none | hairline | strong"standard"Rahmen
      radiusstring: standard | none | control | surface | pill"standard"Ecken-Rundung
      textColorstring""Textfarbe (Token; leer = Standard)
      backgroundColorstring""Hintergrundfarbe (Token; leer = Standard)
      shadowstring: standard | none | sm | md | lg"standard"Schatten
      widthstring: standard | full"standard"Breite
      alignSelfstring: standard | start | center | end"standard"Ausrichtung im Elternteil
      anchorstring""Anker-ID (Sprungziel, z. B. fuer Nav-Links)
      variantstring: dropzone | composer | social"dropzone"Darstellung
      previewsbooleanfalseLokale Dateivorschauen
      maxSizenumber0Maximale Dateigroesse (Bytes)
      uploadUrlstring""Upload-Ziel (optional, gleiche Herkunft)
      chunkSizenumber0Teil-Upload: Stueckgroesse (Bytes, 0 = aus)
      resumablebooleantrueTeil-Upload fortsetzbar
      reloadAfterbooleantrueNach dem Upload neu laden
      uploadLabelstring"Hochladen"Beschriftung Upload-Knopf
      namestring""Formularname
      countNamestring""Formularname der Dateianzahl
      requiredbooleanfalsePflicht
      maxFilesnumber0Höchstens Dateien
      browseLabelstring"Fotos oder Dateien hinzufügen"Dateiauswahl

      * Pflicht-Prop

      Events & Slots

      Events: ⚡ files⚡ uploaded⚡ uploadprogress⚡ uploaderror — im Surface per on: {<event>: {action, params}} verdrahtbar.

      Stellschrauben (Komponenten-Tokens)

      Ebene 3 — aus dem CSS generiert (Registry). Umverdrahtbar per Hüllen-Komposition, ohne Markup-Eingriff; künftige Regler-Quelle des Component Builders.

      TokenDefault
      --file-upload-action-primaryvar(--color-action-primary)
      --file-upload-border-defaultvar(--color-border-default)
      --file-upload-border-strongvar(--color-border-strong)
      --file-upload-form-backgroundvar(--form-background)
      --file-upload-radius-controlvar(--radius-control)
      --file-upload-radius-smvar(--radius-sm)
      --file-upload-radius-surfacevar(--radius-surface)
      --file-upload-status-dangervar(--color-status-danger)
      --file-upload-surface-sunkenvar(--color-surface-sunken)
      --file-upload-text-defaultvar(--color-text-default)
      --file-upload-text-mutedvar(--color-text-muted)
      --file-upload-social-backgroundvar(--color-surface-sunken)
      --file-upload-social-radiusvar(--radius-control)
      --file-upload-social-media-heightvar(--container-xs)
      --file-upload-social-remove-backgroundvar(--color-surface-overlay)
      --file-upload-crop-previewcalc(var(--size-12) * 2)
      --file-upload-crop-stagemin(100%, calc(var(--size-16) * 5))
      --file-upload-crop-shapevar(--radius-full)
      --file-upload-crop-controlvar(--app-control-primary, var(--file-upload-action-primary))

      Genutzte Design-Tokens

      app.control-primaryborder.emphasisborder.hairlinecolor.action.primarycolor.border.defaultcolor.border.focuscolor.border.strongcolor.status.dangercolor.status.successcolor.surface.backdropcolor.surface.defaultcolor.surface.overlaycolor.surface.sunkencolor.text.defaultcolor.text.mutedcontainer.2xscontainer.lgcontainer.xsduration.fasteasing.standardelevation.raisedfocus.ring-colorfocus.ring-offsetfocus.ring-widthfont.family.defaultform.backgroundlayer.dropdownradius.controlradius.fullradius.smradius.surfacesize.1size.12size.16size.2size.20size.3size.4size.6size.8state.disabled-opacitytext.smtext.xltext.xsweight.mediumweight.semibold

      LLM-Notizen

      component.file-upload

      Upload-Zone mit Klick- oder Drag-and-Drop-Auswahl und Dateiliste (Größe, Entfernen).

      Wann nutzen

      • Datei-Auswahl mit sichtbarer Dropzone und Liste.
      • Prototyp ohne Server-Upload — meldet nur die gewählten Dateien; für echten Transport eigene Anbindung nötig.

      Wichtige Props

      • label = Beschriftung über der Zone
      • hint = Format-Hinweis (Default „PNG, JPG oder PDF (max. 10 MB)")
      • multiple = mehrere Dateien erlauben (Default true)
      • accept = accept-Attribut, z. B. image/*,.pdf
      • spacing = Eigenabstand: default | none | sm | md | lg | xl

      Beispiel-Node

      { "definition": "component.file-upload", "props": { "label": "Anhänge", "multiple": true, "accept": "image/*,.pdf" } }

      Hinweise

      • Emittiert files, wenn sich die Auswahl ändert.
      • 1.8.0 crop (Profilbild): { "definition": "component.file-upload", "props": { "label": "Profilbild", "name": "bild", "crop": { "maxEdge": 512, "maxBytes": 180000, "src": "/bild.webp" } } } in einem multipart-Formular - der zugeschnittene Ausschnitt ersetzt die Datei im Feld.
      • 1.9.0 capture (opt-in, Kamera am Handy): user (Frontkamera) | environment (Rückkamera) setzt das capture-Attribut am Dateifeld - das Handy öffnet direkt die Kamera. Nötig, weil Chrome ab Android 14 bei accept: 'image/*' die System-Fotoauswahl ohne Kamera zeigt. Desktop ignoriert es. Für „Galerie ODER Kamera“ zwei Felder nebeneinander (eins mit capture).
      • 1.10.0 Teil-Upload (opt-in, große Dateien): { "definition": "component.file-upload", "props": { "uploadUrl": "/projekte/7/hochladen", "chunkSize": 16777216, "accept": "video/*", "maxSize": 10737418240, "hint": "Videos bis 10 GB" } } – der Knopf sendet jede Datei in Stücken (höchstens 32 MB) an uploadUrl, eines zur Zeit. Vertrag: POST roher Körper mit X-Upload-Id, Content-Range: bytes a-b/gesamt, X-Upload-Name, X-Invisible-Upload: 1 → {ok, fertig, empfangen}; 409 {empfangen} = dort fortsetzen; GET ?upload=<id> = Stand; DELETE ?upload=<id> = verwerfen; 400/403/413 {meldung} ohne empfangen = abgelehnt. resumable (Standard an) merkt die Kennung im localStorage – dieselbe Datei nach dem Neuladen noch einmal wählen setzt fort. reloadAfter: false lädt nicht neu, sondern leert die Liste; die App hört auf uploaded (detail.files[].response). Ereignisse: uploadprogress {name, loaded, total}, uploaderror {name, message}.