ReactJS Blueprint TimezonePicker 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. 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.
- 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:
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.
Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.
Step to Run Application: Run the application using the following command from the root directory of the project:
Output: Now open your browser and go to http://localhost:3000/, you will see the following output: