All Projects → jwlarocque → svelte-dragdroplist

jwlarocque / svelte-dragdroplist

Licence: other
Sortable lists with Svelte 3. Animated, touch-friendly, and accessible.

Programming Languages

HTML
75241 projects

Projects that are alternatives of or similar to svelte-dragdroplist

svelte-progressbar
A multiseries, SVG progressbar component made with Svelte
Stars: ✭ 85 (-15%)
Mutual labels:  svelte-components, svelte-v3
ui-svelte
A component library for Svelte
Stars: ✭ 18 (-82%)
Mutual labels:  svelte-components, svelte-v3
s-date-range-picker
📅 A date range picker built with Svelte
Stars: ✭ 13 (-87%)
Mutual labels:  svelte-components, svelte-v3
ngx-sortable
ngx-sortable is an angular sortable list components that support drag and drop sorting
Stars: ✭ 19 (-81%)
Mutual labels:  drag-and-drop, sortable-lists
Web designer
网页设计器图形化工具,通过拖拽组件进行页面排版和生成页面代码
Stars: ✭ 219 (+119%)
Mutual labels:  drag-and-drop
Dragdroptworecyclerviews
A code example demonstrating a dragging and dropping from one RecyclerView into another RecyclerView.
Stars: ✭ 181 (+81%)
Mutual labels:  drag-and-drop
Phpagebuilder
A drag and drop page builder to manage pages in any PHP project.
Stars: ✭ 168 (+68%)
Mutual labels:  drag-and-drop
Microweber
Drag and Drop Website Builder and CMS with E-commerce
Stars: ✭ 2,226 (+2126%)
Mutual labels:  drag-and-drop
Draggable
The JavaScript Drag & Drop library your grandparents warned you about.
Stars: ✭ 15,671 (+15571%)
Mutual labels:  drag-and-drop
Warewolf
Effortless Microservice Design and Integration. This repository includes the code-base for the Warewolf Studio and Server.
Stars: ✭ 238 (+138%)
Mutual labels:  drag-and-drop
Easy Dnd
A drag and drop implementation for Vue.js 2 https://codesandbox.io/s/easy-dnd-demo-9mbij https://codesandbox.io/s/easy-dnd-demo-2-xnqbz
Stars: ✭ 202 (+102%)
Mutual labels:  drag-and-drop
File Drop
A simple file drag and drop custom-element
Stars: ✭ 188 (+88%)
Mutual labels:  drag-and-drop
Vue.draggable
Vue drag-and-drop component based on Sortable.js
Stars: ✭ 16,530 (+16430%)
Mutual labels:  drag-and-drop
React Dragtastic
A simple drag and drop library for React which uses the more stable mouseDown/mouseUp event pattern instead of the problematic HTML5 drag and drop API
Stars: ✭ 181 (+81%)
Mutual labels:  drag-and-drop
Base64 Encoder
Base64 Encoder
Stars: ✭ 245 (+145%)
Mutual labels:  drag-and-drop
Vue Email Editor
Drag-n-Drop Email Editor Component for Vue.js
Stars: ✭ 166 (+66%)
Mutual labels:  drag-and-drop
React Grid Layout
A draggable and resizable grid layout with responsive breakpoints, for React.
Stars: ✭ 14,732 (+14632%)
Mutual labels:  drag-and-drop
Ng2 Image Upload
Angular 2 component for image uploading
Stars: ✭ 230 (+130%)
Mutual labels:  drag-and-drop
Smart Recycler Adapter
Small, smart and generic adapter for recycler view with easy and advanced data to ViewHolder binding.
Stars: ✭ 197 (+97%)
Mutual labels:  drag-and-drop
Floatingkeyboard
A Draggable and Floating KeyboardView for android that several EditText's can register to use it.
Stars: ✭ 204 (+104%)
Mutual labels:  drag-and-drop

Svelte-DragDropList

Sortable lists made with Svelte. Available from NPM!

Why this component?

  • Bidirectional binding - data order updates as soon as the user drags a list item into a new position, even before it is dropped
  • Full touch support - doesn't use the HTML5 drag and drop API
  • Accessible - includes buttons to move elements without dragging
  • Easier than writing a new one, probably.

Usage

Basic REPL
REPL with every feature!

The simplest way to use the component is to pass it an array of unique strings. If you bind:data, the source array will be updated as the user rearranges its items.

<script>
    import DragDropList from "svelte-dragdroplist";

    let data = ["Adams", "Boston", "Chicago", "Denver"];
</script>

<DragDropList bind:data={data}/>
Unique IDs

If you aren't sure that your strings will be unique, you should instead pass an array of objects, each with a unique ID:

let data = [{"id": 0, "text": "Boston"}, 
            {"id": 1, "text": "Boston"}, 
            {"id": 2, "text": "Chicago"}, 
            {"id": 3, "text": "Denver"}];
HTML

You can also include an "html" attribute instead of "text". It's up to you to make sure the html is clean.
If you want, you can even use both in one list.

let data = [{"id": 0, "text": "Adams"}, 
            {"id": 1, "text": "Boston"}, 
            {"id": 2, "html": "<p style='color: blue;'>Chicago</p>"}, 
            {"id": 3, "html": "<p style='color: red;'>Denver</p>"}];
Removable Items

A delete button can be added to each item with the removesItems prop:

<DragDropList bind:data={data} removesItems={true}/>

Note: adding items is as simple as adding them to the data array.

Styling

To style the list and its elements from a parent component or global stylesheet, prefix your selectors with .dragdroplist. You may need to increase the specificity of your selectors or even use the !important rule in order to override the classes applied by Svelte. For example:

:global(.dragdroplist) {} /* entire component */
:global(.dragdroplist > .list > div.item) {} /* list item */
:global(.dragdroplist div.buttons > button.down) {} /* move down button */
:global(.dragdroplist div.content) {} /* text/html contents of item */

If you only need to style the contents of an item, you can also use an object with an html property as described above.

In Progress

  • Additional animations on drop
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].