Skip to content

Latest commit

 

History

History
232 lines (226 loc) · 6.53 KB

File metadata and controls

232 lines (226 loc) · 6.53 KB
title API
nav
order title path
10
API
/api
name type default description
prefixCls string rc-input-number Specifies the class prefix
min Number Specifies the minimum value
onClick
placeholder string
max Number Specifies the maximum value
step Number or String 1 Specifies the legal number intervals
precision Number Specifies the precision length of value
disabled Boolean false Specifies that an InputNumber should be disabled
required Boolean false Specifies that an InputNumber is required
autoFocus Boolean false Specifies that an InputNumber should automatically get focus when the page loads
readOnly Boolean false Specifies that an InputNumber is read only
changeOnWheel Boolean false Specifies that the value is set using the mouse wheel
controls Boolean true Whether to enable the control buttons
name String Specifies the name of an InputNumber
id String Specifies the id of an InputNumber
value Number Specifies the value of an InputNumber
defaultValue Number Specifies the defaultValue of an InputNumber
allowClear boolean | { clearIcon?: React.ReactNode; clearValue?: T } false If allow to remove input content with clear icon
onClear Function Called when value of an InputNumber cleared
onChange Function Called when value of an InputNumber changed
onBlur Function Called when user leaves an input field
onPressEnter Function The callback function that is triggered when Enter key is pressed.
onFocus Function Called when an element gets focus
onStep (value: T, info: { offset: ValueType; type: 'up' | 'down', emitter: 'handler' | 'keydown' | 'wheel' }) => void Called when the user clicks the arrows on the keyboard or interface and when the mouse wheel is spun.
style Object root style. such as {width:100}
upHandler React.Node custom the up step element
downHandler React.Node custom the down step element
formatter (value: number|string): displayValue: string Specifies the format of the value presented
parser (displayValue: string) => value: number `input => input.replace(/[^\w\.-]*/g, '')` Specifies the value extracted from formatter
pattern string Specifies a regex pattern to be added to the input number element - useful for forcing iOS to open the number pad instead of the normal keyboard (supply a regex of "\d*" to do this) or form validation
decimalSeparator string Specifies the decimal separator
inputMode string Specifies the inputmode of input

inputRef

import InputNumber, { InputNumberRef } from '@rc-component/input-number';

const inputRef = useRef<InputNumberRef>(null);

useEffect(() => {
  inputRef.current.focus(); // the input will get focus
  inputRef.current.blur(); // the input will lose focus
}, []);
// ....
<InputNumber ref={inputRef} />;
Property Type Description
focus (options?: InputFocusOptions) => void The input get focus when called
blur () => void The input loses focus when called