Gathering detailed insights and metrics for @nextapps-be/livewire-sortablejs
Gathering detailed insights and metrics for @nextapps-be/livewire-sortablejs
Gathering detailed insights and metrics for @nextapps-be/livewire-sortablejs
Gathering detailed insights and metrics for @nextapps-be/livewire-sortablejs
A Laravel Livewire plugin that makes it easy to use Sortable.js
npm install @nextapps-be/livewire-sortablejs
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
307 Stars
82 Commits
25 Forks
8 Watchers
5 Branches
6 Contributors
Updated on Jul 12, 2025
Latest Version
0.4.1
Package Id
@nextapps-be/livewire-sortablejs@0.4.1
Unpacked Size
239.36 kB
Size
66.59 kB
File Count
11
NPM Version
10.2.3
Node Version
20.10.0
Published on
Dec 26, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
1
A plugin/wrapper around Sortable.js package.
The livewire-sortable
package uses Shopify's sortable package. We noticed some issues with that package compared to Sortable.js:
x-for
method in an draggable item.Do you want to make the switch from livewire-sortable
to livewire-sortable.js
? That's easy, because this package works exactly the same! The only difference is the javascript package it uses in the background. You will not have to change any Livewire attributes or methods!
1<script src="https://unpkg.com/@nextapps-be/livewire-sortablejs@0.4.0/dist/livewire-sortable.js"></script>
If you use Livewire v2, you need to use v0.2.
1npm install @nextapps-be/livewire-sortablejs --save-dev
Import the package in your bundle:
1import '@nextapps-be/livewire-sortablejs'; 2 3// or 4 5require('@nextapps-be/livewire-sortablejs');
When you only have one list of draggable items (e.g. to-do list), you have to add the following attributes to your html:
wire:sortable="methodName"
: This attribute should be added to the html element that encapsulates all draggable items. The value of this attribute is the Livewire method that will be executed when an item has been dragged.wire:sortable.options
: This optional attribute can be added to the html element that has the wire:sortable
attribute. With the different options of Sortable.js, you can use this attribute to customize how the items are dragged and sorted.wire:sortable.item="itemIdentifier"
: This atttribute should be added to each individual draggable item. The value of this attribute will be used to inform you about the updated order.wire:sortable.handle
: This is an optional attribute. If you provide this attribute, then you will only be able to drag an item by dragging this html element. If you do not provide it, then the complete item will draggable.1<ul wire:sortable="updateTaskOrder" wire:sortable.options="{ animation: 100 }"> 2 @foreach ($tasks as $task) 3 <li wire:sortable.item="{{ $task->id }}" wire:key="task-{{ $task->id }}"> 4 <h4>{{ $task->title }}</h4> 5 <button wire:sortable.handle>drag</button> 6 </li> 7 @endforeach 8</ul>
When the order is updated, you will receive the following array structure in your Livewire method:
1[ 2 [ 3 'order' => 1, // order of item (starts at 1, not 0) 4 'value' => 20, // item id 5 ], 6]
When you have multiple lists, each with items that can be moved between those different lists, you have to add the following attributes to your html:
wire:sortable-group="methodName"
: This attribute should be added to the html element that encapsulates all lists. The value of this attribute is the Livewire method that will be executed when an item has been dragged.wire:sortable-group.item-group="groupIdentifier"
: This atttribute should be added to the root element of a list with draggable items. The value of this attribute will be used to inform you about the updated order.wire:sortable-group.options
: This optional attribute can be added to every html element that has the wire:sortable-group.item-group
attribute. With the different options of Sortable.js, you can use this attribute to customize how the items are dragged and sorted.wire:sortable-group.item="itemIdentifier"
: This atttribute should be added to each individual draggable item in each list. The value of this attribute will be used to inform you about the updated order.wire:sortable-group.handle
: This is an optional attribute. If you provide this attribute, then you will only be able to drag an item by dragging this html element. If you do not provide it, then the complete item will draggable.1<div wire:sortable-group="updateTaskOrder"> 2 @foreach ($groups as $group) 3 <div wire:key="group-{{ $group->id }}"> 4 <h4>{{ $group->label }}</h4> 5 6 <ul wire:sortable-group.item-group="{{ $group->id }}" wire:sortable-group.options="{ animation: 100 }"> 7 @foreach ($group->tasks()->orderBy('order')->get() as $task) 8 <li wire:sortable-group.item="{{ $task->id }}" wire:key="task-{{ $task->id }}"> 9 <span>{{ $task->title }}</span> 10 <button wire:sortable-group.handle>drag</button> 11 </li> 12 @endforeach 13 </ul> 14 </div> 15 @endforeach 16</div>
When an item is dragged, you will receive the following array structure in the Livewire method you provided to the wire:sortable-group
directive (in this example, the updateTaskOrder
method):
1[ 2 [ 3 'order' => 1, // order of group (starts at 1, not 0) 4 'value' => 20, // group id 5 'items' => [ 6 [ 7 'order' => 1, // order of item within group (starts at 1, not 0) 8 'value' => 50, // item id 9 ] 10 ] 11 ] 12]
When you have multiple lists, each with items that can be moved between those different lists and the lists themselves also need to be draggable, you have to add the following attributes to your html:
wire:sortable="methodName"
: This attribute should be added to the html element that encapsulates all draggable groups. The value of this attribute is the Livewire method that will be executed when a group has been dragged.
wire:sortable.options
: This optional attribute can be added to the html element that has the wire:sortable
attribute. With the different options of Sortable.js, you can use this attribute to customize how the groups are dragged and sorted.
wire:sortable.item="groupIdentifier"
: This atttribute should be added to each individual draggable group. The value of this attribute will be used to inform you about the updated group order.
wire:sortable.handle
: This is an optional attribute. If you provide this attribute, then you will only be able to drag a group by dragging this html element. If you do not provide it, then the complete group will draggable.
wire:sortable-group="methodName"
: This attribute should be added to the html element that encapsulates all lists. The value of this attribute is the Livewire method that will be executed when an item has been dragged.
wire:sortable-group.item-group="groupIdentifier"
: This atttribute should be added to the root element of a list with draggable items. The value of this attribute will be used to inform you about the updated order.
wire:sortable-group.options
: This optional attribute can be added to every html element that has the wire:sortable-group.item-group
attribute. With the different options of Sortable.js, you can use this attribute to customize how the items are dragged and sorted.
wire:sortable-group.item="itemIdentifier"
: This atttribute should be added to each individual draggable item in each list. The value of this attribute will be used to inform you about the updated order.
wire:sortable-group.handle
: This is an optional attribute. If you provide this attribute, then you will only be able to drag an item by dragging this html element. If you do not provide it, then the complete item will draggable.
1<div wire:sortable="updateGroupOrder" wire:sortable-group="updateTaskOrder" wire:sortable.options="{ animation: 50 }"> 2 @foreach ($groups as $group) 3 <div wire:sortable.item="{{ $group->id }}" wire:key="group-{{ $group->id }}"> 4 <h4>{{ $group->label }}</h4> 5 <button wire:sortable.handle>drag group</button> 6 7 <ul wire:sortable-group.item-group="{{ $group->id }}" wire:sortable-group.options="{ animation: 100 }"> 8 @foreach ($group->tasks()->orderBy('order')->get() as $task) 9 <li wire:sortable-group.item="{{ $task->id }}" wire:key="task-{{ $task->id }}"> 10 <span>{{ $task->title }}</span> 11 <button wire:sortable-group.handle>drag item</button> 12 </li> 13 @endforeach 14 </ul> 15 </div> 16 @endforeach 17</div>
When an item is dragged, you will receive the following array structure in the Livewire method you provided to the wire:sortable-group
directive (in this example, the updateTaskOrder
method):
1[ 2 [ 3 'order' => 1, // order of group (starts at 1, not 0) 4 'value' => 20, // group id 5 'items' => [ 6 [ 7 'order' => 1, // order of item within group (starts at 1, not 0) 8 'value' => 50, // item id 9 ] 10 ] 11 ] 12]
When a group is dragged, you will receive the following array structure in the Livewire method you provided to the wire:sortable
directive (in this example, the updateGroupOrder
method):
1[ 2 [ 3 'order' => 1, // order of group (starts at 1, not 0) 4 'value' => 20, // group id 5 ] 6]
1npm run build
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
This package is inspired by Livewire's official livewire-sortable plugin.
The MIT License (MIT). Please see License File for more information.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 2/19 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More