mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 12:23:02 +00:00
docs(file-uploader): document "validateFiles"
This commit is contained in:
parent
6dc47c377a
commit
72e57e61b8
1 changed files with 16 additions and 1 deletions
|
@ -52,7 +52,22 @@ The default `FileUploaderItem` size is "default".
|
|||
|
||||
### Drop container
|
||||
|
||||
<FileUploaderDropContainer labelText="Drag and drop files here or click to upload" multiple />
|
||||
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.
|
||||
|
||||
<FileUploaderDropContainer
|
||||
labelText="Drag and drop files here or click to upload"
|
||||
multiple
|
||||
validateFiles={files => {
|
||||
return files.filter(file => file.size < 1_024)
|
||||
}}
|
||||
on:change={e=> {
|
||||
console.log("files", e.detail)
|
||||
}}
|
||||
/>
|
||||
|
||||
### Skeleton
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue