![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
svelte-sortable-items
Advanced tools
svelte-sortable-items is a svelte/sveltekit package to create sortable drag-and-drop items. This package allows you to relate a javascript array to sortable HTML elements.
svelte-sortable-items is a svelte/sveltekit package to create sortable drag-and-drop items. This package allows you to relate a javascript array to sortable HTML elements.
svelte-sorting-items differs from other svelte sorting packages by not committing to a specific html structure (like "ul/li" lists). Furthermore, it promotes sorting from the child elements only, instead of sorting the children of a parent element. This allows a non-opinionated structure/styling and, consequently, the ordering of more flexible structures, such as the lines of a table for example.
npm install svelte-sortable-items
<script lang="ts">
import { MoveIcon, SortableItem } from 'svelte-sortable-items';
import { flip } from 'svelte/animate';
let stateUsers = $state([
{ id: 1, name: 'John', age: 45 },
{ id: 2, name: 'Mark', age: 33 },
{ id: 3, name: 'Jonas', age: 56 },
{ id: 4, name: 'Mary', age: 76 },
]);
let stateHoveredItem = $state<number>(-1);
</script>
<svelte:head>
<!-- MAKE IT WORK ON MOBILE DEVICES -->
<script src="https://unpkg.com/svelte-drag-drop-touch"></script>
<!---->
</svelte:head>
<p>MOVE THE <MoveIcon propSize={12} /> ICON TO REORDER ELEMENTS.</p>
{#each stateUsers as currentUser, numberCounter (currentUser.id)}
<div animate:flip>
<SortableItem
propItemNumber={numberCounter}
bind:propData={stateUsers}
bind:propHoveredItemNumber={stateHoveredItem}
>
<div class:classHovered={stateHoveredItem === numberCounter}>
<MoveIcon propSize={12} />
{currentUser.name}
</div>
</SortableItem>
</div>
{/each}
<p>{JSON.stringify(stateUsers)}</p>
<style>
.classHovered {
background-color: lightblue;
color: white;
}
</style>
To run the examples from /src/routes
:
git clone https://github.com/joaquimnetocel/svelte-sortable-items.git
cd svelte-sortable-items
npm install
npm run dev
SortableItem
: A component to create sortable html elements.MoveIcon
: An icon commonly used to sort items.SortableItem
:PROP | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
---|---|---|---|---|
propData (bindable) | AN ARRAY WITH THE DATA. | unknown[] | YES | - |
propItemNumber | THE INITIAL POSITION OF THE ITEM. | number | YES | undefined |
propHoveredItemNumber (bindable) | THE HOVERED ITEM NUMBER (GENERALY USED TO DO SPECIFIC STYLING WHEN HOVERING). | number | NO | -1 |
MoveIcon
:PROP | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
---|---|---|---|---|
propSize | SIZE OF THE SORT ICON | number | NO | 12 |
FAQs
svelte-sortable-items is a svelte/sveltekit package to create sortable drag-and-drop items. This package allows you to relate a javascript array to sortable HTML elements.
We found that svelte-sortable-items demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.