Skip to content

Commit 7a5df07

Browse files
author
Tk2217
committed
Add documentation for File and Upload components
1 parent 4f166ed commit 7a5df07

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,3 +436,76 @@ Slot Props & Events:
436436
```
437437

438438
Note: Each data item in the collection contains the document data AND fields for the `id` and `ref` (DocumentReference).
439+
440+
### `<File>`
441+
442+
Retrives a file from Firebase storage.
443+
444+
Props:
445+
446+
- *path (required)* to file in storage i.e `images/mountain.jpg`
447+
448+
Slots:
449+
450+
- *default slot* shown when file is available.
451+
- *loading* shown when waiting for response.
452+
- *fallback* shown when error occurs.
453+
454+
455+
Slot Props & Events:
456+
457+
- *url* url to resource
458+
- *ref* File Reference for direct acess
459+
460+
```html
461+
<File {path} let:url let:ref>
462+
463+
<img src={url} />
464+
465+
<div slot="loading">
466+
Loading...
467+
</div>
468+
469+
<div slot="fallback">
470+
Error
471+
</div>
472+
473+
</File>
474+
```
475+
476+
### `<Upload>`
477+
478+
Props:
479+
480+
- *path (required)* to upload to i.e "images/mountain.jpg"
481+
- *file* file to upload as a file object `Blob` or `Unit8Array`
482+
483+
Slots:
484+
485+
- *default slot* shown before upload is complete.
486+
- *complete* shown when upload is complete.
487+
- *fallback* shown when error occurs or upload is cancelled.
488+
489+
490+
Slot Props & Events:
491+
492+
- *url* url to uploaded file.
493+
- *task* Firebase upload task.
494+
- *snapshot* snapshot of upload, useful for monitoring progress.
495+
496+
497+
```html
498+
<Upload {file} {path} let:task let:snapshot let:url>
499+
500+
Uploading your file... {snaphot.bytesTransferred}
501+
502+
<div slot="complete">
503+
Download here {url}
504+
</div>
505+
506+
<div slot="fallback">
507+
Error or canceled
508+
</div>
509+
510+
</Upload>
511+
```

0 commit comments

Comments
 (0)