{
 "id": "file-dropzone",
 "name": "File dropzone",
 "purpose": "A calm drop area for statements or documents, with a browse link, the accepted types, and each file's state: uploaded, uploading with progress, or failed with a retry.",
 "use_when": [
  "where people upload documents or statements",
  "a form step that needs several documents, where people must see which ones failed and retry them"
 ],
 "avoid_when": [
  "attaching a source to a message for an assistant: use ai-composer, which has its own attach button",
  "a long list of uploaded files to search and manage later: use receipts-table"
 ],
 "type": "form",
 "style": "quiet",
 "width": "medium",
 "tags": {
  "audience": "work",
  "industries": [
   "any"
  ],
  "keywords": [
   "upload",
   "dropzone",
   "files",
   "progress",
   "attachments"
  ]
 },
 "root": ".odl-file-dropzone",
 "parts": [
  {
   "name": "title",
   "selector": ".odl-head h3",
   "what": "what to upload",
   "slot": "text"
  },
  {
   "name": "intro",
   "selector": ".odl-head p",
   "what": "what happens to the files and where they are kept",
   "slot": "text"
  },
  {
   "name": "drop",
   "selector": ".odl-drop",
   "what": "the dashed drop area; its text changes to 'Drop to upload' while a file is dragged over",
   "slot": "none"
  },
  {
   "name": "browse",
   "selector": ".odl-browse",
   "what": "a link-styled label holding the real file input",
   "slot": "input"
  },
  {
   "name": "types",
   "selector": ".odl-types",
   "what": "accepted file types and the size limit",
   "slot": "text"
  },
  {
   "name": "files",
   "selector": "ul > li",
   "what": "one file: type tile, name, size or status, progress bar while uploading, and its buttons",
   "slot": "list"
  },
  {
   "name": "name",
   "selector": ".odl-name",
   "what": "the file name",
   "slot": "text"
  },
  {
   "name": "meta",
   "selector": ".odl-meta",
   "what": "size and result, progress left, or why it failed",
   "slot": "text"
  },
  {
   "name": "progress",
   "selector": ".odl-bar",
   "what": "upload progress for one file",
   "slot": "number"
  },
  {
   "name": "retry",
   "selector": ".odl-retry",
   "what": "tries a failed upload again",
   "slot": "action"
  },
  {
   "name": "remove",
   "selector": ".odl-icon-btn",
   "what": "removes a file or cancels its upload",
   "slot": "action"
  },
  {
   "name": "total",
   "selector": ".odl-foot",
   "what": "how many files are uploaded and their total size",
   "slot": "text"
  }
 ],
 "data": {
  "type": "object",
  "required": [
   "title",
   "accept"
  ],
  "properties": {
   "title": {
    "type": "string",
    "maxLength": 40,
    "part": "title"
   },
   "intro": {
    "type": "string",
    "maxLength": 140,
    "part": "intro"
   },
   "accept": {
    "type": "string",
    "maxLength": 60,
    "part": "browse"
   },
   "types": {
    "type": "string",
    "maxLength": 60,
    "part": "types"
   },
   "files": {
    "type": "array",
    "minItems": 0,
    "maxItems": 8,
    "part": "files",
    "items": {
     "type": "object",
     "required": [
      "name",
      "state"
     ],
     "properties": {
      "name": {
       "type": "string",
       "maxLength": 120,
       "part": "name"
      },
      "state": {
       "enum": [
        "done",
        "uploading",
        "failed",
        "queued"
       ]
      },
      "meta": {
       "type": "string",
       "maxLength": 70,
       "part": "meta"
      },
      "progress": {
       "type": "number",
       "minimum": 0,
       "maximum": 100,
       "part": "progress"
      }
     }
    }
   },
   "total": {
    "type": "string",
    "maxLength": 48,
    "part": "total"
   }
  }
 },
 "states": {
  "shown": [
   "hover",
   "focus",
   "drag over",
   "uploaded",
   "uploading",
   "failed",
   "queued"
  ],
  "edge": {
   "empty": {
    "status": "handled",
    "how": "when the last file is removed the footer says there are no files and focus goes back to the file input",
    "evidence": "No files yet"
   },
   "loading": {
    "status": "shown",
    "how": "a file being uploaded shows a progress bar with its value and the time left",
    "evidence": "role=\"progressbar\""
   },
   "error": {
    "status": "shown",
    "how": "a failed file gets a red border and tile, the reason in its status line, and a Retry button",
    "evidence": "li[data-state=\"failed\"] { border-color: var(--ds-color-border-danger); }"
   },
   "disabled": {
    "status": "not_built",
    "how": "set disabled on the file input and dim the drop area, for example once the file limit is reached"
   },
   "overflow": {
    "status": "not_built",
    "how": "the file list grows with every file; past about eight, give the list a max height and its own scroll"
   },
   "long_text": {
    "status": "handled",
    "how": "a long file name ends in an ellipsis on wider boxes and wraps in a narrow one",
    "evidence": ".odl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"
   },
   "missing_image": {
    "status": "none",
    "how": "the part has no photo"
   }
  }
 },
 "tokens": [
  "--ds-border-width-default",
  "--ds-border-width-emphasis",
  "--ds-color-bg-accent-subtle",
  "--ds-color-bg-action-primary",
  "--ds-color-bg-danger-subtle",
  "--ds-color-bg-neutral-subtle",
  "--ds-color-bg-neutral-subtle-hover",
  "--ds-color-bg-success-subtle",
  "--ds-color-border-danger",
  "--ds-color-border-default",
  "--ds-color-border-focus",
  "--ds-color-border-strong",
  "--ds-color-border-subtle",
  "--ds-color-icon-accent",
  "--ds-color-icon-default",
  "--ds-color-icon-subtle",
  "--ds-color-surface-raised",
  "--ds-color-surface-sunken",
  "--ds-color-text-accent",
  "--ds-color-text-danger",
  "--ds-color-text-link",
  "--ds-color-text-primary",
  "--ds-color-text-secondary",
  "--ds-color-text-success",
  "--ds-color-text-tertiary",
  "--ds-elevation-raised",
  "--ds-focus-ring-offset",
  "--ds-focus-ring-width",
  "--ds-font-weight-label",
  "--ds-icon-stroke-md",
  "--ds-motion-duration-medium",
  "--ds-motion-duration-short",
  "--ds-motion-easing-standard",
  "--ds-radius-container",
  "--ds-radius-control-sm",
  "--ds-radius-detail",
  "--ds-radius-full",
  "--ds-radius-nested",
  "--ds-size-control-md",
  "--ds-size-control-sm",
  "--ds-size-icon-md",
  "--ds-size-icon-sm",
  "--ds-size-target-min",
  "--ds-space-2",
  "--ds-space-4",
  "--ds-space-inline-md",
  "--ds-space-inline-sm",
  "--ds-space-inline-xs",
  "--ds-space-inset-lg",
  "--ds-space-inset-md",
  "--ds-space-inset-sm",
  "--ds-space-inset-xl",
  "--ds-space-inset-xs",
  "--ds-space-section-sm",
  "--ds-space-stack-lg",
  "--ds-space-stack-sm",
  "--ds-space-stack-xs",
  "--ds-text-body-md",
  "--ds-text-label-md",
  "--ds-text-title-md"
 ],
 "a11y": {
  "summary": "A real file input sits inside the browse label, so keyboard users can pick files; the list is a polite live region, the progress bar has role progressbar with a value, and every remove and retry button names its file.",
  "roles": [
   "list",
   "progressbar",
   "region"
  ],
  "keyboard": [
   "Tab reaches the browse link, which holds the real file input, then each file's Retry and Remove buttons",
   "Enter or Space on browse opens the system file picker",
   "After a file is removed, focus moves to the next file's first button, or back to the file input when none are left"
  ],
  "controls": {
   "button": 6,
   "input": 1,
   "link": 0,
   "select": 0,
   "textarea": 0,
   "summary": 0
  },
  "focus_visible": true,
  "reduced_motion": true,
  "min_target": true
 },
 "files": {
  "html": "components/file-dropzone/component.html",
  "bytes": 19331,
  "script": true
 },
 "source": "brand/showcase/components/04-upload-brutal",
 "photos": 0,
 "urls": {
  "html": "https://opendesigner.dev/library/file-dropzone.html",
  "json": "https://opendesigner.dev/library/file-dropzone.json",
  "page": "https://opendesigner.dev/library/file-dropzone/"
 },
 "get": {
  "curl": "curl -fsSLo file-dropzone.html https://opendesigner.dev/library/file-dropzone.html",
  "opendesigner": "python3 path/to/skills/opendesigner/scripts/library.py add file-dropzone --from https://opendesigner.dev",
  "prompt": "Add the OpenDesigner component file-dropzone to this project: https://opendesigner.dev/library/file-dropzone.html. Keep its markup and states; map its --ds-* variables to my tokens."
 }
}
