React UI Components Documentation
The React NumberInput enables users to input numbers. This guide adds the React NumberInput (jqxNumberInput) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-scriptsjqwidgets-scripts/jqwidgets-react-tsx/jqxnumberinput 
In a React project (to start one, see Getting started with React), add the package:
npm install jqwidgets-scripts
import JqxNumberInput from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxnumberinput';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.base.css';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.tailwind-blue-dark.css';
jqx.base.css is required. The second file is a theme; pick one of the jqx.*.css files (material, fluent, light, dark and more) and pass its name to the theme prop.
The source of the live Default Functionality demo:
import type { JSX } from 'react';
import JqxNumberInput from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxnumberinput';
function App(): JSX.Element {
return (
<div>
<div style={{ marginTop: '10px' }}>Number</div>
<JqxNumberInput theme="tailwind-blue-dark" width={250} height={25} spinButtons />
<div style={{ marginTop: '10px' }}>Percentage</div>
<JqxNumberInput
theme="tailwind-blue-dark"
width={250}
height={25}
symbolPosition="right"
symbol="%"
spinButtons
digits={3}
/>
<div style={{ marginTop: '10px' }}>Currency</div>
<JqxNumberInput
theme="tailwind-blue-dark"
width={250}
height={25}
symbol="$"
spinButtons
/>
<div style={{ marginTop: '10px' }}>Disabled</div>
<JqxNumberInput
theme="tailwind-blue-dark"
width={250}
height={25}
disabled
spinButtons
/>
</div>
);
}
export default App;
Options are props. Keep objects such as the data adapter and the columns stable across renders with useMemo, so the component does not reload them.
Each event is a prop named on plus the event name with a capital first letter. For example, change: This event is triggered when the value is changed and the control's focus is lost.
const handleChange = (event: any): void => {
console.log(event.args);
};
return <JqxNumberInput onChange={handleChange} />;
Call methods through a ref. For example, val: Sets or gets the value.
import { useRef } from 'react';
const myNumberInput = useRef<JqxNumberInput>(null);
const onClick = () => {
const value = myNumberInput.current!.val();
console.log(value);
};
return <JqxNumberInput ref={myNumberInput} />;
Every component also has setOptions({ … }) and getOptions('name'), to change or read options after the first render.