Open In App

React Suite DateRangePicker ts:Placement Props

Last Updated : 15 Jul, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products.

DateRangePicker component allows the user to quickly select a date range. Now, these DateRangePicker can be placed in around 13 different positions . This placement can be any of the positions mentioned below:

DateRangePicker ts: Placement Props = ‘bottomStart’ | ‘bottomEnd’ | ‘topStart’ | ‘topEnd’ | ‘leftStart’ | ‘leftEnd’ | ‘rightStart’ | ‘rightEnd’ | ‘auto’ | ‘autoVerticalStart’ | ‘autoVerticalEnd’ | ‘autoHorizontalStart’ | ‘autoHorizontalEnd’;

Syntax:

// Import Statement
import { DateRangePicker } from 'rsuite';
// App.js file
Function App() {
    return (
        <DateRangePicker placeholder="" placement="auto" />
    );
}

Approach: Let us create a React project and install React Suite module. Then we will create a UI that will showcase React Suite DateRangePicker ts: Placement Props.

Creating React Project:

Step 1: To create a react app, you need to install react modules through npx command. “npx” is used instead of “npm” because you will be needing this command in your app’s lifecycle only once.

npx create-react-app project_name

Step 2: After creating your react project, move into the folder to perform different operations.

cd project_name

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

npm install rsuite

Project Structure: After running the commands mentioned in the above steps, if you open the project in an editor you can see a similar project structure as shown below. The new component user makes or the code changes, we will be performing will be done in the source folder.

Project Structure

Example 1: We are creating a UI that shows different React Suite DateRangePicker ts: Placement props.

App.js




import React from 'react'
import '../node_modules/rsuite/dist/rsuite.min.css';
import { DateRangePicker } from 'rsuite';
  
export default function App() {
    return (
        <center>
            <div style={{ padding: 20 }}>
                <h2>GeeksforGeeks</h2>
                <h2 style={{ color: "green" }}>
                    React Suite DateRangePicker ts: Placement Props</h2>
                <br /><br /><br /><br />
                <DateRangePicker style={{ width: 300, marginRight: 200 }} 
                    placeholder="Bottom Start Date Range" 
                    placement="bottomStart" />
                <DateRangePicker style={{ width: 300 }} 
                    placeholder="Bottom End Date Range" 
                    placement="bottomEnd" />
                <br /><br /><br />
                <DateRangePicker style={{ width: 300, marginRight: 200 }} 
                    placeholder="Right Start Date Range" 
                    placement="rightStart" />
                <DateRangePicker style={{ width: 300 }} 
                    placeholder="Left Start Date Range" 
                    placement="leftStart" />
                <br /><br /><br />
                <DateRangePicker style={{ width: 300, marginRight: 200 }}
                    placeholder="Right End Date Range" 
                    placement="rightEnd" />
                <DateRangePicker style={{ width: 300 }} 
                    placeholder="Left End Date Range" 
                    placement="leftEnd" />
                <br /><br /><br />
                <DateRangePicker style={{ width: 300, marginRight: 200 }} 
                    placeholder="Top Start Date Range" 
                    placement="topStart" />
                <DateRangePicker style={{ width: 300 }} 
                    placeholder="Top End Date Range" 
                    placement="topEnd" />
            </div>
        </center>
    );
}


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:

React Suite DateRangePickers

Example 2: We are creating a UI that shows React Suite DateRangePicker ts: Placement props.

App.js




import React from 'react'
import '../node_modules/rsuite/dist/rsuite.min.css';
import { DateRangePicker } from 'rsuite';
  
export default function App() {
    return (
        <center>
            <div style={{ padding: 20 }}>
                <h2>GeeksforGeeks</h2>
                <h2 style={{ color: "green" }}>
                    React Suite DateRangePicker ts: Placement Props</h2>
                <br /><br /><br /><br /><br /><br />
                <DateRangePicker style={{ width: 300 }} 
                    placeholder="Select Date Range" 
                    placement="auto" />
                <br /><br /><br />
                <DateRangePicker style={{ width: 300 }} 
                    placeholder="Select Date Range" 
                    placement="autoHorizontalStart" />   
                <DateRangePicker style={{ width: 300 }} 
                    placeholder="Select Date Range" 
                    placement="autoHorizontalEnd" />
                <br /><br /><br />
                <DateRangePicker style={{ width: 300 }} 
                    placeholder="Select Date Range" 
                    placement="autoVerticalStart" />   
                <DateRangePicker style={{ width: 300 }} 
                    placeholder="Select Date Range" 
                    placement="autoVerticalEnd" />
            </div>
        </center>
    );
}


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

React Suite DateRangePickers

Reference: https://rsuitejs.com/components/date-range-picker/#code-ts-placement-code



Similar Reads

React Suite DateRangePicker Props
React Suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, we’ll learn about React suite DateRangePicker Prop. DateRangePicker Component is used to quickly s
4 min read
React Suite DateRangePicker ts:DisabledDateFunction Props
React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. It is a set of react component libraries for enterprise system products. It is a well-thought-out and developer-friendly UI framework. DateRangePicker Component is used to quickly select a date range. DisabledDa
2 min read
React Suite DateRangePicker ts:Ranges Props
React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. It is a set of react component libraries for enterprise system products. It is a well-thought-out and developer-friendly UI framework. The DatePicker Component is used to choose a time or date from the picker. T
4 min read
React Suite DateRangePicker Component
React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. DateRangePicker component allows the user to quickly select a date range. We can use the following approach in ReactJS to use the React Suite DateRangePicker Component. DateRangePicker Props: appearance: It is u
4 min read
React Suite DateRangePicker One tap
React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. React Suite DateRangePicker component provides the user an interface to select a date range. React Suite DateRangePicker Component’s oneTap prop takes a boolean value. It denotes whether to click once on the sel
3 min read
React Suite DateRangePicker Appearance
React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. React Suite DateRangePicker component provides the user an interface to select a date range. React Suite DateRangePicker Component's appearance prop defines how the DateRangePicker will visually appear to the us
2 min read
React Suite DateRangePicker Date Time or Time
React Suite is a popular front-end UI framework that consisted of a set of React components that we can use in our react application. It is developer-friendly and supports the stable releases of all the modern browsers like Chrome, Edge, Firefox, Safari, etc. In this article, we will discuss React Suite DateRangePicker Date Time or Time. The DateRa
3 min read
React Suite DateRangePicker Custom Shortcut Options
React Suite is a front-end UI framework that has a set of React components that developers can use in their react app to fasten the development process. It supports all the major browsers like Chrome, Safari, Firefox, Brave, etc. In this example, we will be seeing React Suite DateRangePicker Custom Shortcut Options. The DateRangePicker component is
3 min read
React Suite DateRangePicker Block
React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. The DateRangePicker component allows the user to quickly select a date range. DateRangePicker can be of different sizes which include extra-small, small, medium, and large. It can also occupy the full width. Syn
3 min read
React Suite DateRangePicker Show One Calendar
React Suite is a front-end UI framework that has a set of React components that developers can use in their react app to fasten the development process. It supports all the major browsers like Chrome, Safari, Firefox, Brave, etc. In this example, we will see React Suite DateRangePicker Show One Calendar. The DateRangePicker component is used to tak
3 min read