Skip to content
kitn AI/UI

File Upload

kai-file-upload

Accepts a click or a drag and hands you the files that were chosen.

  • 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/web-components';
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.
SlotModePurpose
injectCustom dropzone content, replacing the default label (the `label` prop is the fallback).
PropertyTypeDefaultNotes
theme'auto'Color mode (`auto` follows prefers-color-scheme).
multipletrueAllow picking more than one file. Default true.
accept—`accept` for the file picker, e.g. `image/*`.
disabledfalseNo clicking and no drag-and-drop.
label'Click or drop files to upload'Default dropzone label; replace it with your own markup 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