FormFileUpload wraps FilePond and requires a parent Form (same context as other Form* fields). It will not work outside Form context unless you pass a matching contextKey.
Setup
<script lang="ts">
import { Form, FormFileUpload } from '.';
</script> Usage with Form
<script lang="ts">
import { Form, FormFileUpload, Button } from '.';
import { z } from 'zod';
const schema = z.object({
file: z.any().optional()
});
</script>
<Form {schema} onSubmit={() => {}}>
<FormFileUpload
name="file"
label="Upload document"
title="Click Browse or drop a file"
subTitle="PDF or images up to 10MB"
allowMultiple={false}
/>
<Button type="submit">Submit</Button>
</Form> Multiple files and MIME filter
<script lang="ts">
import { Form, FormFileUpload } from '.';
import { z } from 'zod';
const schema = z.object({
attachments: z.any().optional()
});
</script>
<Form {schema} onSubmit={() => {}}>
<FormFileUpload
name="attachments"
label="Attachments"
title="Drop files here"
allowMultiple
acceptedFileTypes={['application/pdf', 'image/png', 'image/jpeg']}
onChange={(files) => console.log(files)}
/>
</Form> Accessibility
- Provide a visible
label; FilePond exposes its own browse control. - Surface validation via Form errors (
showError) and keep required state explicit. - Prefer clear
title/subTitlecopy describing allowed types.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
name | string | required | Form field key |
label | string | required | Visible field label |
title | string | required | Dropzone primary copy |
subTitle | string | — | Secondary dropzone copy |
url | string | — | Optional upload endpoint |
allowMultiple | boolean | false | Multi-file |
acceptedFileTypes | string[] | images/pdf/xlsx | MIME allowlist |
files | any[] | — | Initial / controlled files |
required | boolean | false | Required field |
showError | boolean | — | Show Form validation error |
imageOnly | boolean | false | Restrict to images |
contextKey | any | — | Alternate Form context key |
onChange | (val: any) => void | — | Change callback |
All Form* upload fields must sit under a Form that sets the matching context (contextKey or the default form key).