File
File attachment with a real file list: names, sizes, remove buttons. A dropzone variant adds drag and drop.
Single file
PDF or image, up to 5 MB.
<File
id="receipt"
name="receipt"
label="Receipt"
accept=".pdf,.png,.jpg"
hint="PDF or image, up to 5 MB."
/>Dropzone
The dropzone variant satisfies the Upload/Dropzone roadmap item: drag-and-drop plus a file list with remove is built in.
<File id="gallery" name="gallery" label="Gallery images" multiple dropzone accept="image/*" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
accept | string | - | Native accept filter. |
multiple | boolean | false | Allow several files. |
dropzone | boolean | false | Drag & drop area instead of a button. |
Events
document.addEventListener("ink:file:change", (event) => {
console.log(event.detail.files);
});Accessibility
- The visible button/dropzone is a
<label for>; the real input stays keyboard operable. - Remove buttons carry
aria-label="Remove [filename]". - Drag and drop is an enhancement; everything works without it.