JGuang

NumberKeyboard <Experimental></Experimental>

NumberKeyboard <Experimental></Experimental> · Ant Design Mobile

Preview
npm install antd-mobile@5.43.0

NumberKeyboard <Experimental></Experimental>

Numeric keypad panel.

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.

Numeric keypad panel.

When to Use

Applicable when entering numeric content.

Can be used with password input box component or custom input box component

If possible, we recommend using the native keyboard provided by the system or client. The virtual numeric keypad is just a supplement for some special scenarios.

Demos

tips: It is recommended to open the demo on the mobile side for better preview effect, because the touch event used by the component cannot be seen on the web side.

NumberKeyboard

Props

NameDescriptionTypeDefault
afterCloseCallback when the keyboard is completely put away() => void-
afterShowCallback when the keyboard is completely bounced() => void-
closeOnConfirmWhether to automatically close when the ok button is clickedbooleantrue
confirmTextThe text of the confirm button, if null is set, it would be shownstring | nullnull
customKeyCustomized buttonstring | { key: string; title: string } | (string | { key: string; title: string })[]-
destroyOnCloseDestroy dom when not visiblebooleanfalse
forceRenderRender content forcelybooleanfalse
getContainerTo get the specified mounted HTML node, the default is body, if null returned, it would be rendered to the current nodeHTMLElement | () => HTMLElement | null() => document.body
onCloseTriggered when it is clicked() => void-
onConfirmTriggered when the ok button is clicked() => void-
onDeleteCallback when the content is deleted() => void-
onInputCallback when the input content is changed(v: string) => void-
randomOrderWhether the keyboard is out of orderbooleanfalse
safeAreaWhether to enable safe area paddingbooleantrue
showCloseButtonWhether to show the collapsed keyboard arrowbooleantrue
titleThe title of the keyboardstring-
visibleWhether to show or hideboolean-

In addition, the following attributes of Popup are supported: stopPropagation

FAQ

Does the NumberKeyboard support automatic reading of verification codes from SMS?

No.