JGuang

ActionSheet

ActionSheet · Ant Design Mobile

Preview
npm install antd-mobile@5.43.0

ActionSheet

Action menu panel that pops up from the bottom.

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.

Action menu panel that pops up from the bottom.

When to Use

Triggered by user operation, it provides a set of two or more options related to the current scene operation, allowing the user to complete the operation without leaving the scene.

Demos

ActionSheet

Props

NameDescriptionTypeDefaultVersion
actionsThe option list of the the action sheetAction[][]
afterCloseTriggered when completely closed() => void-
cancelTextThe text of the cancel button , if it is null, the cancel button would not be displayedReactNode-
closeOnActionWhether to close after clicking the optionbooleanfalse
closeOnMaskClickWhether to close after clicking the mask layerbooleantrue
destroyOnCloseDestroy dom when not visiblebooleanfalse
forceRenderRender content forcelybooleanfalse
extraThe extra area at the top of the the action sheetReactNode-
getContainerGet the specified mounted HTML node, the default is body, if null returned, it would be rendered to the current nodeHTMLElement | () => HTMLElement | nulldocument.body
onActionTriggered when an option is clicked, never triggered when the ActionSheet is disabled or loading(action: Action, index: number) => void-
onCloseTriggered when closed() => void-
onMaskClickTriggered when the mask layer is clicked() => void-
popupClassNameActionSheet popup class namestring-
safeAreaWhether to enable safe area paddingbooleantrue
visibleTo show or hide the action sheetbooleanfalse
stylesSemantic structure stylePartial<Record<'body' | 'mask', CSSProperties>>-5.33.0

Action

NameDescriptionTypeDefault
dangerWhether dangerous or notbooleanfalse
descriptionThe description of the actionReactNode-
disabledWhether disabled or notbooleanfalse
keyThe unique markstring | number-
onClickTriggered on click() => void-
textTitleReactNode-
boldWhether the title is boldbooleanfalse

Imperative

ActionSheet can be used in an imperative way :

const handler = ActionSheet.show(props)

The ActionSheet can be directly opened by calling the show method on the ActionSheet. The types of the props parameter is the same as the above table, but the visible property is not supported.

When the ActionSheet is closed, the component instance would be automatically destroyed.

The return value of the show method is a component controller, which contains the following properties :

NameDescriptionType
closeTo close the ActionSheet() => void