--- components: ["FileUploaderButton", "FileUploader", "FileUploaderDropContainer", "FileUploaderItem", "FileUploaderSkeleton"] --- ## File uploader (button-only) By default, the file uploader only accepts one file. Set `multiple` to `true` for multiple files to be accepted. ## Multiple files ## Custom button kind, size By default, the `primary` small button kind is used. Use the `kind` and `size` props to customize the button. ## File uploader The `FileUploader` wraps `FileUploaderButton` and lists out uploaded files. The example below accepts multiple files with an extension of `.jpg` or `.jpeg`. It sets the status to `"complete"`; by default, the status is `"loading"`. See the [item examples below](#item-uploading) for different statuses. ## Clear files There are two ways to clear files in `FileUploader`: programmatically using the clearFiles accessor two-way binding by setting files to [] ## File uploader (disabled state) ## Item (uploading) ## Item (complete) ## Item (edit) If the `status` is `"edit"`, clicking the close icon will dispatch a `delete` event. The event detail contains the item `id`. { console.log(e.detail); // "readme" }} /> ## Item (edit status, invalid state) An item can also have an edit status with an invalid state. ## Item (edit status, invalid state with subject, body) Use the `errorSubject` and `errorBody` props to customize the error message. ## Item sizes The default `FileUploaderItem` size is "default". ## Drop container The `FileUploaderDropContainer` accepts files through click and drop events. Use the `validateFiles` prop to filter out files before they are set. The following example accepts files smaller than 1 kB. { return files.filter(file => file.size < 1_024) }} on:change={e=> { console.log("files", e.detail) }} /> ## Skeleton