Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Svelte component for fileupload

NotificationsYou must be signed in to change notification settings

thecodejack/svelte-file-dropzone

Repository files navigation

NPMnpm bundle size (minified + gzip)

SvelteJS component for file upload and dropzone.The component is Svelte implementation ofreact-dropzone.

Demo

Click here for Storybook link

Installation

npm install svelte-file-dropzoneoryarn add svelte-file-dropzone

Usage

<script>importDropzonefrom"svelte-file-dropzone";let files= {    accepted: [],    rejected: []  };functionhandleFilesSelect(e) {const {acceptedFiles,fileRejections }=e.detail;files.accepted= [...files.accepted,...acceptedFiles];files.rejected= [...files.rejected,...fileRejections];  }</script><Dropzoneon:drop={handleFilesSelect} /><ol>  {#eachfiles.acceptedasitem}    <li>{item.name}</li>  {/each}</ol>

API

Props

Prop NameDescriptionDefault Value
acceptSet accepted file types. Seehttps://github.com/okonet/attr-accept for more information.undefined
disabledfalse
maxSizeInfinity
minSize0
multipleif true, multiple files can be selected at oncetrue
preventDropOnDocument1231true
noClickdisable click eventsfalse
noKeyboarddisable keyboard eventsfalse
noDragdisable drag eventsfalse
containerClassescustom container classes""
containerStylescustom inline container styles""
disableDefaultStylesdon't apply default styles to containerfalse
inputElementreference to inputElementundefined
requiredhtml5 required attribute added to inputfalse

Events

Event NameDescriptionevent.detail info
dragenter{dragEvent: event}
dragover{dragEvent: event}
dragleave{dragEvent: event}
drop{acceptedFiles,fileRejections,event}
filedropped{event}
droprejected{fileRejections,event}
dropaccepted{acceptedFiles,event}
filedialogcancel

Examples

Click here to view stories implementation

Credits

Component is reimplementationreact-dropzone. Complete credit goes to author and contributors ofreact-dropzone.

License

MIT

About

Svelte component for fileupload

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors11

Languages


[8]ページ先頭

©2009-2025 Movatter.jp