--- components: ["FileUploaderButton", "FileUploader", "FileUploaderDropContainer", "FileUploaderItem", "FileUploaderSkeleton"] --- The `FileUploader` components provide a complete solution for file uploads, including a button trigger, drag-and-drop container, and file list display. The components support various states, file validation, and customization options. ## File uploader (button-only) Create a simple file upload button using `FileUploaderButton`. By default, it accepts a single file. Set `multiple` to `true` to allow multiple file selection. ## Multiple files Enable multiple file selection by setting the `multiple` prop to `true`. This allows users to select multiple files at once. ## Custom button kind, size Customize the button appearance using the `kind` and `size` props. The default is a small primary button. ## File uploader The `FileUploader` component combines a button trigger with a list of uploaded files. It supports file type restrictions, multiple file selection, and various upload states. This example accepts multiple JPEG files and displays them in a completed state. ## Clear files Remove uploaded files from the `FileUploader` component in two ways: programmatically using the clearFiles accessor two-way binding by setting files to [] ## File uploader (disabled state) Disable the file uploader by setting the `disabled` prop to `true`. This prevents user interaction with the component. ## Item (uploading) Display a file upload in progress using the `uploading` status. This shows a loading indicator and the file name. ## Item (complete) Show a successfully uploaded file using the `complete` status. This displays a checkmark icon next to the file name. ## Item (edit) Enable file deletion by setting the status to `"edit"`. Clicking the close icon dispatches a `delete` event with the item's ID. { console.log(e.detail); // "readme" }} /> ## Item (edit status, invalid state) Mark a file as invalid while keeping it editable. This shows an error icon and allows the user to remove the file. ## Item (edit status, invalid state with subject, body) Provide detailed error messages for invalid files using the `errorSubject` and `errorBody` props. This helps users understand and resolve upload issues. ## Item sizes Customize the size of file uploader items using the `size` prop. The default size is "default". ## Drop container Use `FileUploaderDropContainer` for drag-and-drop file uploads. It supports file validation and multiple file selection. This example accepts files smaller than 1 kB and logs the selected files to the console. { return files.filter(file => file.size < 1_024) }} on:change={e=> { console.log("files", e.detail) }} /> ## Skeleton Display a loading state using the `FileUploaderSkeleton` component. This provides visual feedback while the file uploader content is being loaded.