Sunday, September 7, 2025
HomeLanguagesJavascriptReactJS Blueprint NumberInput Component

ReactJS Blueprint NumberInput Component

BlueprintJS is a React-based UI toolkit for the web. This library is very optimized and popular for building interfaces that are complex data-dense for desktop applications.

NumberInput Component provides a way for users to provide them a number input. It is a basic component to collect numeric data from the user. We can use the following approach in ReactJS to use the ReactJS Blueprint NumberInput Component.

NumberInput Props:

  • allowNumericCharactersOnly: Whether to allow only floating-point number characters in the field.
  • asyncControl: We can control the value of this input with asynchronous updates when this is set to true.
  • buttonPosition: It is used to denote the position of the buttons with respect to the input field.
  • clampValueOnBlur: It is used to indicate whether the value should be clamped to [min, max] on blur.
  • className: It is used to denote the space-delimited list of class names to pass along to a child element.
  • defaultValue: It is used to denote the initial value of the input, for uncontrolled usage.
  • disabled: It is used to indicate whether or not the input is non-interactive.
  • fill: It is used to indicate whether or not the component should take up the full width of its container.
  • inputRef: It is used to denote the ref handler or a ref object that receives HTML <input> element backing this component.
  • intent: It is used to denote the visual intent color to apply to the element.
  • large: It is used to indicate whether or not this input should use large styles.
  • leftIcon: It is used to denote the name of an icon or an icon element to render on the left side of an input.
  • locale: It is used to denote the locale name, which is passed to the component to format the number and allowing to type the number in the specific locale.
  • majorStepSize: It is used to denote the increment between successive values when shift is held.
  • max: It is used to denote the maximum value of the input.
  • min: It is used to denote the minimum value of the input.
  • minorStepSize: It is used to denote the increment between successive values when alt is held.
  • onButtonClick: It is a callback function that is triggered when the value changes due to a button click.
  • onValueChange: It is a callback function that is triggered when the value changes due to typing, arrow keys, or button clicks.
  • placeholder: It is used to denote the placeholder text in the absence of any value.
  • rightElement: It is used to denote the element to render on the right side of an input.
  • selectAllOnFocus: It is used to indicate whether the entire text field should be selected on focus or not.
  • selectAllOnIncrement: It is used to indicate whether the entire text field should be selected on increment.
  • stepSize: It is used to denote the increment between successive values when no modifier keys are held.
  • value: It is used to denote the value to display in the input field.

 

Creating React Application And Installing Module:

  • Step 1: Create a React application using the following command:

    npx create-react-app foldername
  • Step 2: After creating your project folder i.e. foldername, move to it using the following command:

    cd foldername
  • Step 3: After creating the ReactJS application, Install the required module using the following command:

    npm install @blueprintjs/core

Project Structure: It will look like the following.

Project Structure

Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.

App.js




import React from 'react'
import '@blueprintjs/core/lib/css/blueprint.css';
import { NumericInput } from "@blueprintjs/core";
  
function App() {
    return (
        <div style={{
            display: 'block', width: 400, padding: 30
        }}>
            <h4>ReactJS Blueprint NumericInput Component</h4>
            <NumericInput
                disabled={false}
                leftIcon="user"
                onChange={() => { console.log("Called on change of value") }}
                placeholder="Enter your phone number"
            />
        </div >
    );
}
  
export default App;


Step to Run Application: Run the application using the following command from the root directory of the project:

npm start

Output: Now open your browser and go to http://localhost:3000/, you will see the following output:

Reference: https://blueprintjs.com/docs/#core/components/numeric-input

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32271 POSTS0 COMMENTS
Milvus
82 POSTS0 COMMENTS
Nango Kala
6641 POSTS0 COMMENTS
Nicole Veronica
11807 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11870 POSTS0 COMMENTS
Shaida Kate Naidoo
6755 POSTS0 COMMENTS
Ted Musemwa
7030 POSTS0 COMMENTS
Thapelo Manthata
6705 POSTS0 COMMENTS
Umr Jansen
6721 POSTS0 COMMENTS