Svelte File Upload - Bitblue

FilePond-powered uploads wired into Bitblue form context

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 / subTitle copy describing allowed types.

Props

PropTypeDefaultDescription
namestringrequiredForm field key
labelstringrequiredVisible field label
titlestringrequiredDropzone primary copy
subTitlestring—Secondary dropzone copy
urlstring—Optional upload endpoint
allowMultiplebooleanfalseMulti-file
acceptedFileTypesstring[]images/pdf/xlsxMIME allowlist
filesany[]—Initial / controlled files
requiredbooleanfalseRequired field
showErrorboolean—Show Form validation error
imageOnlybooleanfalseRestrict to images
contextKeyany—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).


© 2026 Bitblue is a registered trademark. All Rights Reserved.