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

svelte-droplet

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-droplet

File dropzone for Svelte

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
206
decreased by-39.41%
Maintainers
0
Weekly downloads
 
Created
Source

Svelte Droplet

NPM License NPM Downloads test

File dropzone for Svelte

REPL

Install

npm install svelte-droplet

Usage

<script lang="ts">
	import { FileDrop } from 'svelte-droplet'
	function handleFiles(files: File[]) {
		for (const file of files) {
			console.log(file.name)
		}
	}
</script>
<FileDrop {handleFiles} let:droppable>
	<div class="zone" class:droppable>Select or drop files here</div>
</FileDrop>

Props

PropTypeDescription
handleFiles(files: File[]) => voidFile handler function
acceptedMimesstring[] | nullList of allowed MIME types, like image/jpeg or image/*. Invalid files are ignored.
You can also use file extensions like .jpg but it will not enable droppable when the file is hovering, meaning you can't display a hover effect.
Defaults to null (all are allowed)
maxnumber | nullMax number of files allowed. Extra files are ignored. Defaults to 0 (no limit)
disabledbooleanDisables the component
namestring | nullName of the input field, useful for forms
tabindexnumberSet a custom tabindex

Slot props

PropTypeDescription
droppablebooleanTrue if the dropzone is currently hovered with valid files

Dev instructions

Get started

  1. Install Node.js (v14 works)
  2. Run npm install

Commands

  • npm run dev: Start in dev mode
  • npm run build: Build
  • npm run preview: Preview production app
  • npm run lint: Lint
  • npm run format: Format

Publish new version

  1. Update CHANGELOG.md
  2. Check for errors
    npm run lint
    
  3. Bump the version number
    npm version --no-git-tag <version>
    
  4. Generate the package
    npm run package
    
  5. Publish the package
    npm publish
    
  6. Commit with a tag in format "v#.#.#"
  7. Create GitHub release with release notes

Keywords

FAQs

Package last updated on 23 Oct 2024

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