Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

ReactJS Blueprint InputGroup Component

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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.

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

InputGroup Props:

  • asyncControl: We can control the value of this input with asynchronous updates when this is set to true.
  • 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.
  • leftElement: It is used to denote the element to render on the left side of an input.
  • leftIcon: It is used to denote the name of an Icon to render on the left side of the input group just before the user cursor.
  • onChange: It is used to denote the change event handler.
  • 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 the input.
  • round: It is used to indicate whether or not the input (and any buttons) should appear with rounded caps.
  • small: It is used to indicate whether or not this input should use small styles.
  • type: It is used to denote the HTML input type attribute.
  • value: It is used to denote the form value of the input, for controlled usage.

TextArea Props:

  • className: It is used to denote a space-delimited list of class names to pass along to a child element.
  • fill: It is used to indicate whether or not the text area should take up the full width of its container.
  • growVertically: It is used to indicate whether or not the text area should automatically grow vertically to accommodate content.
  • inputRef: It is used to denote the ref handler that receives HTML <textarea> element backing this component.
  • intent: It is used to denote the visual intent color to apply to element.
  • large: It is used to indicate whether or not the text area should appear with large styling.
  • small: It is used to indicate whether or not the text area should appear with small styling.

 

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 { InputGroup } from "@blueprintjs/core";
  
function App() {
    return (
        <div style={{
            display: 'block', width: 400, padding: 30
        }}>
            <h4>ReactJS Blueprint TextInput Component</h4>
            <InputGroup
                disabled={false}
                leftIcon="user"
                onChange={() => { console.log("Called on change of value") }}
                placeholder="Enter your name"
            />
        </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/text-inputs


My Personal Notes arrow_drop_up
Last Updated : 10 Jul, 2021
Like Article
Save Article