FileUpload renders an area for uploading files with a native HTML file input. It handles click and drag events and provides an onChange handler that lets you submit the form based on the uploaded file data and display previews of the uploaded files.
<FileUpload name="file" onChange={console.log}>
Drop files to attach
</FileUpload>
If you want to use a separate trigger element inside FileUpload instead of making the whole component clickable, you can use FileUpload.Trigger. The entire area will still handle drag events.
<FileUpload name="file">
Drop files to attach, or{" "}
<FileUpload.Trigger>
<Link variant="plain">browse</Link>
</FileUpload.Trigger>
</FileUpload>
You can use the children property to create any composition your product needs. For example, you can add an icon in addition to rendering text.
<FileUpload name="file">
<View gap={2}>
<Icon svg={MicIcon} size={6} />
Drop files to attach
</View>
</FileUpload>