Open In App

ReactJS Blueprint TimezonePicker Component

Last Updated : 09 Jul, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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. TimezonePicker Component provides a way for users to select from a list of timezones. We can use the following approach in ReactJS to use the ReactJS Blueprint TimezonePicker Component.

TimezonePicker Props:

  • buttonProps: It is used to denote the props to spread to the target Button.
  • className: It is used to denote a space-delimited list of class names to pass along to a child element.
  • date: It is used to denote the date to use when formatting timezone offsets.
  • disabled: It is used to indicate whether this component is non-interactive.
  • inputProps: It is used to denote the props to spread to the filter InputGroup.
  • onChange: It is a callback function that is triggered when the user selects a timezone.
  • placeholder: It is used to denote the text to show when no timezone has been selected.
  • popoverProps: It is used to denote the props to spread to Popover.
  • showLocalTimezone: It is used to indicate whether to show the local timezone at the top of the list of initial timezone suggestions.
  • value: It is used to denote the currently selected timezone UTC identifier.
  • valueDisplayFormat: It is used for the formatting display date and use it when displaying the selected (or default) timezone within the target element.

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
    npm install @blueprintjs/popover2

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 { TimezonePicker } from "@blueprintjs/timezone";
  
function App() {
    return (
        <div style={{
            display: 'block', width: 700, padding: 30
        }}>
            <h4>ReactJS Blueprint TimezonePicker Component</h4>
            <TimezonePicker />
        </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/#timezone/timezone-picker


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads