
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
@sandstreamdev/react-swipeable-list
Advanced tools
Demo • Installation • Usage • Contributors
A control to render list with swipeable items. Items can have action on left and right swipe. Swipe action triggering can be configured.
Check working example page or experiment on:
npm install @sandstreamdev/react-swipeable-list
# or via yarn
yarn add @sandstreamdev/react-swipeable-list
import { SwipeableList, SwipeableListItem } from '@sandstreamdev/react-swipeable-list';
import '@sandstreamdev/react-swipeable-list/dist/styles.css';
<SwipeableList>
<SwipeableListItem
swipeLeft={{
content: <div>Revealed content during swipe</div>,
action: () => console.info('swipe action triggered')
}}
swipeRight={{
content: <div>Revealed content during swipe</div>,
action: () => console.info('swipe action triggered')
}}
onSwipeProgress={progress => console.info(`Swipe progress: ${progress}%`)}
>
<div>Item name</div>
</SwipeableListItem>
</SwipeableList>
or use function as children pattern if other container is needed (check animation and styled container examples). Note that in this case you need to provide list wrapper and pass default className
props to have same behaviour. Default SwipeableList
styles are passed in className
prop.
<SwipeableList>
{({ className, ...rest }) => (
<div className={className}>
<SwipeableListItem
swipeLeft={{
content: <div>Revealed content during swipe</div>,
action: () => console.info('swipe action triggered')
}}
swipeRight={{
content: <div>Revealed content during swipe</div>,
action: () => console.info('swipe action triggered')
}}
{...rest}
>
<div>Item name</div>
</SwipeableListItem>
</div>
)}
</SwipeableList>
Type: number
(optional, default: 10
)
How far in pixels scroll needs to be done to block swiping. After scrolling is started and goes beyond the threshold, swiping is blocked.
It can be set for the whole list or for every item. See scrollStartThreshold
for SwipeableListItem
. Value from the SwipeableListItem
takes precedence.
Type: number
(optional, default: 10
)
How far in pixels swipe needs to be done to start swiping on list item. After a swipe is started and goes beyond the threshold, scrolling is blocked.
It can be set for the whole list or for every item. See swipeStartThreshold
for SwipeableListItem
. Value from the SwipeableListItem
takes precedence.
Type: number
(optional, default: 0.5
)
How far swipe needs to be done to trigger attached action. 0.5
means that item needs to be swiped to half of its width, 0.25
- one-quarter of width.
It can be set for the whole list or for every item. See threshold
for SwipeableListItem
. Value from the SwipeableListItem
takes precedence.
Type: boolean
(optional, default: false
)
If set to true
all defined swipe actions are blocked.
Type: Anything that can be rendered
(required)
Content that is visible by default and swipeable to reveal the left and right views.
Type: Object
(optional)
Data for defining left swipe action and rendering content after item is swiped. The object requires following structure:
{
action, // required: swipe action (function)
actionAnimation, // optional: type of animation
content, // required: HTML or React component
}
Type: function
(required)
Callback function that should be run when swipe is done beyond threshold.
Type: ActionAnimations (RETURN | REMOVE | NONE)
(optional, default: RETURN
)
Animation type to be played swipe is done beyond threshold.
Type: Anything that can be rendered
(required)
Content that is revealed when swiping.
Type: Object
Same as swipeLeft
but to right. :wink:
Type: number
(default: 10
)
How far in pixels scroll needs to be done to block swiping. After scrolling is started and goes beyond the threshold, swiping is blocked.
It can be set for the whole list or for every item. See scrollStartThreshold
for SwipeableList
. Value from the SwipeableListItem
takes precedence.
Type: number
(default: 10
)
How far in pixels swipe needs to be done to start swiping on list item. After a swipe is started and goes beyond the threshold, scrolling is blocked.
It can be set for the whole list or for every item. See swipeStartThreshold
for SwipeableList
. Value from the SwipeableListItem
takes precedence.
Type: number
(default: 0.5
)
How far swipe needs to be done to trigger attached action. 0.5
means that item needs to be swiped to half of its width, 0.25
- one-quarter of width.
It can be set for the whole list or for every item. See threshold
for SwipeableList
. Value from the SwipeableListItem
takes precedence.
Type: () => void
Fired after swipe has started (after drag gesture passes the swipeStartThreshold
distance in pixels).
Type: () => void
Fired after swipe has ended.
Type: (progress: number) => void
Fired every time swipe progress changes. The reported progress
value is always an integer in range 0 to 100 inclusive.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
Swipeable list component for React
We found that @sandstreamdev/react-swipeable-list demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.