Skip to content

InputFile

Use InputFile to let shoppers upload files from a form, such as documents or images. It renders a styled label over a native file input and reports selections through the onChange callback.

The SDK InputFile showing a file upload control.
import { InputFile } from '/@dropins/tools/components.js';
PropTypeReq?Description
acceptstringNoRestrict the selectable file types (for example, “.pdf,.jpg”).
onChange(event: Event) => voidNoCalled when the file selection changes.
labelstringNoThe label text. Defaults to ‘Upload Document’.
multiplebooleanNoAllow selecting multiple files.
iconVNode<HTMLAttributes<SVGSVGElement>>NoAn optional icon shown before the label.

InputFile also accepts standard input HTML attributes (for example, id, name, and disabled), except type and icon.

Render a file input that accepts documents and allows multiple selections.

import { InputFile, provider } from '/@dropins/tools/components.js';
await provider.render(InputFile, {
label: 'Upload files',
accept: '/.pdf,.jpg,.png',
multiple: true,
onChange: (event) => yourHandleFiles(event),
})(document.querySelector('.file-input'));
  • Input — a text input for form fields.
  • InputPassword — a password field with a show/hide toggle.