JGuang

SwipeAction

SwipeAction · Ant Design Mobile

Preview
npm install antd-mobile@5.43.0

SwipeAction

Function extension for lists.

Install

npm install antd-mobile@5.43.0

antd-mobile is for mobile web, not React Native or Mini Programs. React 19 projects must register createRoot with unstableSetRender at the entry, or imperative APIs such as Toast and Dialog cannot render. Switch dark mode with <html data-prefers-color-scheme="dark">.

Examples come from the official Ant Design Mobile repository (MIT) at the commit published as npm 5.43.0. Presentation helpers such as DemoBlock are JGuang rewrites, not antd-mobile APIs.

Function extension for lists.

When to Use

Swipe to reveal hidden function menus.

Demos

SwipeAction

Props

NameDescriptionTypeDefaultVersion
closeOnActionWhether to return to the position automatically when the operation button is clickedbooleantrue
closeOnTouchOutsideWhether to return to the position automatically when other areas is clickedbooleantrue
leftActionsList of operation buttons on the leftAction[][]
rightActionsList of operation buttons on the rightAction[][]
onActionTriggered when operation button is clicked(action: Action, e: React.MouseEvent) => void-
stopPropagationStop the propagation of some events.PropagationEvent[][]
onActionsRevealTriggered when the operation button appears completely(side: 'left' | 'right') => void-
onCloseTriggered when the slide bar returns to the position() => void-5.39.0

Action

NameDescriptionTypeDefault
colorColor'light' | 'weak' | 'primary' | 'success' | 'warning' | 'danger' | string'light'
keyThe unique identificationstring | number-
onClickTrigger when clicked(e: React.MouseEvent) => void-
textTextReactNode-

Ref

NameDescriptionType
closeLet the slide bar return to the position() => void
showSlide out the operation button, the side parameter defaults to right(side?: 'left' | 'right') => void

CSS Variables

NameDescriptionDefault
--backgroundbackground color#ffffff