A customizable sortable component for React
npm install react-sortify-componentA customizable, touch-friendly sortable component for React.
š Live Demo
``bash`
npm install react-sortify-componentor
yarn add react-sortify-component
`tsx
import React, { useState } from 'react';
import {Sortable, sortableArray } from 'react-sortify-component';
import 'react-sortify-component/Sortable.css';
const initialData = [
{ id: 1, content:
export default function Example() {
const [data, setData] = useState
return (
onChange={setData}
/>
);
}
`
| Name | Type | Default | Description |
|--------------------|-------------------------------------|-----------|---------------------------------------------|
| data | sortableArray | required | Array of items to sort |(newData: sortableArray) => void
| onChange | | required | Called when order changes |number
| animationDuration | | 300 | Animation duration in ms |string
| customClass | | | Custom class for container |boolean
| isSortable | | true | Enable/disable sorting |React.ReactNode
| dragHandle | | | Custom drag handle |string` | | Custom class for sortable items |
| sortableItemClass |
If you face any issues or have questions, you're welcome to raise an issue on GitHub.
MIT