react-jquery-sortable
0.1.0-alpha.5 • Public • Published react-jquery-sortable
Demo
Usage
- Include jQuery and jQuery UI globally (this is required because of a jQuery UI limitation)
- Configure webpack to support
import '$' from 'jquery'
(see externals
in webpack.config.common.js
)
- Create the
Sortable
(see Example.jsx
).
Code Example
import Sortable from 'react-jquery-sortable';
import Widget from './Widget';
function Example({ onChange, widgets, ...props }) {
return (
<Sortable
forcePlaceholderSize
handle=".handle"
onChange={order => onChange(order)}
placeholder="placeholder"
{...props}
>
{widgets.map(widget => (
<Widget
handleClassName=".handle"
id={widget.get('id')}
key={widget.get('id')}
widget={widget}
/>
))}
</Sortable>
);
}
Setup
yarn
yarn start
# Visit http://localhost:8080
Package Sidebar
Install
npm i react-jquery-sortable
Weekly Downloads