JGuang

Stepper

Stepper · Ant Design Mobile

Preview
npm install antd-mobile@5.43.0

Stepper

A two-stage control that increases, decreases or modifies values.

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.

A two-stage control that increases, decreases or modifies values.

When to Use

It is suitable for inputting and adjusting the current value within a certain range.

Demos

Stepper

Props

NameDescriptionTypeDefaultVersion
allowEmptyWhether to allow empty content.booleanfalse
defaultValueDefault valuenumber | null0
digitsFormat to a fixed number of digits after the decimal point, set to 0 means format to integer. Will use formatter as display value when configurednumber-
disabledWhether to disabled Stepperbooleanfalse
formatterFormat value in input(value?: number) => string-5.26.0
inputReadOnlyWhether input readonly or notbooleanfalse
maxMax valuenumber-
minMin valuenumber-
onBlurTriggered when the input lose focus(e: React.FocusEvent<HTMLInputElement>) => void-
onChangeCallback when value is changed(value: number | null) => void-
onFocusTriggered when the input get focus(e: React.FocusEvent<HTMLInputElement>) => void-
parserParse input text into number which should work with formatter(text: string) => number-5.26.0
stepThe value to increase or decrease each time, can be a decimalnumber1
stringModeSet value as string to support high precision decimals. Will set defaultValue,value, min, max, onChange to string typebooleanfalse5.27.0
valueCurrent number, controlled valuenumber | null-

When allowEmpty is true, the value parameter of onChange may be null, please pay attention when using it.

Ref

NameDescriptionType
blurLet the input box lose focus() => void
focusLet the input box get focus() => void
nativeElementNative input elementHtmlInputElement | null

CSS Variables

NameDescriptionDefault
--active-borderIn the focus state, the border style.var(--border)
--borderBorder style.none
--border-innerInner border style.solid 2px transparent
--border-radiusRadius of the stepper.2px
--button-background-colorBackground color of the button.#f5f5f5
--button-font-sizeFont size of the button.15px
--button-text-colorFont color of the button.var(--adm-color-primary)
--button-widthWidth of the button.var(--height)
--heightHeight of the stepper.28px
--input-background-colorBackground color of input.#f5f5f5
--input-font-colorFont color of the input.var(--adm-color-text)
--input-font-sizeFont size of input.var(--adm-font-size-main)
--input-widthWidth of the input.44px