Skip to content
kitn AI/UI

File Upload

kai-file-upload

A click-or-drag dropzone that fires one event with the selected files — constrain it to a file type, limit to a single pick, or lock it entirely with a single attribute.

  • Shadow DOM
  • 1 event
  • Click or drag-and-drop
  • Filterable by file type
  • Customisable label

All four props are plain HTML attributes — nothing to set in JavaScript:

<kai-file-upload accept="image/*" label="Drop an image to upload"></kai-file-upload>
<script type="module">
import '@kitn.ai/ui/elements';
document.querySelector('kai-file-upload')
.addEventListener('kai-files-added', (e) => console.log(e.detail.files));
</script>
  • accept — standard accept attribute (e.g. image/*, .pdf,.docx). Omit to allow any file type.
  • multiple — boolean, defaults to true. Set multiple="false" to restrict to a single file.
  • kai-files-added — fires with detail.files as a native File[]; pass straight to FormData or your upload function.

Accepts any file type; click or drag to trigger kai-files-added.

accept="image/*" and multiple={false} — useful for avatar or cover-photo uploads.

Override the default copy with label when context makes it too generic.

Lock the dropzone while an upload is in progress or the user lacks permissions.

PropertyTypeDefaultNotes
multiple true Allow selecting multiple files (default true).
accept `accept` attribute for the file picker (e.g. `image/*`).
disabled false Disable the dropzone — no clicking, no drag-and-drop.
label 'Click or drop files to upload' Default dropzone label (overridable via the default slot).
EventDetailNotes
Files were picked or dropped.

This element wraps these SolidJS components — reach for them directly when you need finer control than the props expose.

FileUploadFileUploadTrigger