Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

arackaf-svelte-file-dropzone

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arackaf-svelte-file-dropzone

Svelte component for fileupload and file dropzone

  • 0.0.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

svelte-file-dropzone

NPM npm bundle size (minified + gzip)

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

Demo

Click here for Storybook link

Installation

npm install svelte-file-dropzone

or

yarn add svelte-file-dropzone

Usage

<script>
  import Dropzone from "svelte-file-dropzone";

  let files = {
    accepted: [],
    rejected: []
  };

  function handleFilesSelect(e) {
    const { acceptedFiles, fileRejections } = e.detail;
    files.accepted = [...files.accepted, ...acceptedFiles];
    files.rejected = [...files.rejected, ...fileRejections];
  }
</script>

<Dropzone on:drop={handleFilesSelect} />
<ol>
  {#each files.accepted as item}
    <li>{item.name}</li>
  {/each}
</ol>

API

Props

Prop NameDescriptionDefault Value
acceptSet accepted file types. See https://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 reimplementation react-dropzone. Complete credit goes to author and contributors of react-dropzone.

License

MIT

Keywords

FAQs

Package last updated on 11 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc