React UI Components Documentation
The React FormattedInput enables users to format numbers in various numeric formats. This guide adds the React FormattedInput (jqxFormattedInput) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-scriptsjqwidgets-scripts/jqwidgets-react-tsx/jqxformattedinput 
In a React project (to start one, see Getting started with React), add the package:
npm install jqwidgets-scripts
import JqxFormattedInput from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxformattedinput';
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 JqxFormattedInput from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxformattedinput';
function App(): JSX.Element {
return (
<JqxFormattedInput
width={250}
height={25}
radix="decimal"
value={15}
spinButtons={true}
dropDown={true}
/>
);
}
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.
const handleChange = (event: any): void => {
console.log(event.args);
};
return <JqxFormattedInput onChange={handleChange} />;
Call methods through a ref. For example, val: Sets or gets the value.
import { useRef } from 'react';
const myFormattedInput = useRef<JqxFormattedInput>(null);
const onClick = () => {
const value = myFormattedInput.current!.val();
console.log(value);
};
return <JqxFormattedInput ref={myFormattedInput} />;
Every component also has setOptions({ … }) and getOptions('name'), to change or read options after the first render.