![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
react-reorder-list
Advanced tools
Readme
A simple react component that facilitates the reordering of JSX/HTML elements through drag-and-drop functionality, allowing for easy position changes.
To install react-reorder-list
# with npm:
npm install react-reorder-list --save
# with yarn:
yarn add react-reorder-list
# with pnpm:
pnpm add react-reorder-list
# with bun:
bun add react-reorder-list
react-reorder-list
default exports <ReorderList>
component which encapsulates all the list items as its children.
Items in this list can be reordered by simply dragging an item and dropping it in place of another item.
An item can be dragged by clicking anywhere inside the item.
import React from 'react'
import ReorderList from 'react-reorder-list'
export default function App() {
return <ReorderList useOnlyIconToDrag={false}>
{[0, 1, 2, 3, 4].map(i=> {
{/* Having a unique key is important */}
return <div key={i}>{i}</div>
})}
</ReorderList>
}
An item can be dragged only using the <ReorderIcon>
present inside the item.
import React from 'react'
import ReorderList, { ReorderIcon } from 'react-reorder-list'
export default function App() {
return <ReorderList>
{[0, 1, 2, 3, 4].map(i=> {
return <div key={i}>
<ReorderIcon />
<span>{i}</span>
</div>
})}
</ReorderList>
}
import React from 'react'
import ReorderList, { ReorderIcon } from 'react-reorder-list'
export default function App() {
return <ReorderList>
{[0, 1, 2].map(i => {
return <div key={i}>
<ReorderIcon />
<span>{'Parent' + i}</span>
<ReorderList>
{[0, 1, 2].map(j => {
return <div key={j} style={{ paddingLeft: '16px' }}>
<ReorderIcon />
<span>{'Child' + i + j}</span>
</div>
})}
</ReorderList>
</div>
})}
</ReorderList>
}
Here is the full API for the <ReorderList>
component, these properties can be set on an instance of ReorderList:
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
useOnlyIconToDrag | Boolean | No | true | See usage with ReorderIcon |
selectedItemOpacity | Number (0 to 1) | No | 0.5 | This determines the opacity of the item being dragged, until released. |
onPositionChange | PositionChangeHandler | No | - | |
disable | Boolean | No | false | When set to true, ReorderList will work as a plain div with no functionality. |
props | React.DetailedHTMLProps | No | - | Props to customize the <ReorderList> component. |
import { ReactNode } from 'react';
type PositionChangeHandler = (params?: { start?: number, end?: number, oldItems?: ReactNode, newItems?: ReactNode }) => void
FAQs
A simple react component that facilitates the reordering of JSX/HTML elements through drag-and-drop functionality, allowing for easy position changes.
The npm package react-reorder-list receives a total of 73 weekly downloads. As such, react-reorder-list popularity was classified as not popular.
We found that react-reorder-list demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.