Friday, November 22, 2024
Google search engine
HomeLanguagesReact Suite CheckPicker Placement

React Suite CheckPicker Placement

React Suite is a front-end library designed for the middle platform and back-end products. React Suite CheckPicker component is used as multiple selectors of data. We can also group data using this component.

The placement of the React Suite CheckPicker component defines the position of the CheckPicker. It takes these values – ‘bottomStart’, ‘bottomEnd’, ‘topStart’, ‘topEnd’, ‘leftStart’, ‘leftEnd’, ‘rightStart’, ‘rightEnd’, ‘auto’, ‘autoVerticalStart’, ‘autoVerticalEnd’, ‘autoHorizontalStart’, ‘autoHorizontalEnd’.

Syntax:

<CheckPicker placement=""/>

Prerequisite:

Creating React Application and Module installation:

Step 1: Create the react project folder, for that open the terminal, and write the command npm create-react-app folder name, if you have already installed create-react-app globally. If you haven’t, install create-react-app globally using the command npm -g create-react-app or install locally by npm i create-react-app.

npm create-react-app project

Step 2: After creating your project folder(i.e. project), move to it by using the following command.

cd project

Step 3:  now install the dependency by using the following command:

npm install rsuite

Project Structure: It will look like this:

 

Example 1: We are importing the CheckPicker Component from “rsuite” and to apply the default styles of the components we are importing “rsuite/dist/rsuite.min.css”. Now to the CheckPicker component, we are passing different values to the placement prop.

App.js




import { CheckPicker } from "rsuite";
import "rsuite/dist/rsuite.min.css";
  
function App() {
  const style = {
    textAlign: "center",
  };
  return (
    <div className="App">
      <h4> React Suite CheckPicker Placement </h4>
      <div style={style}>
        <CheckPicker placement="topStart" 
          placeholder="topStart" />
        <CheckPicker placement="topEnd" 
          placeholder="topEnd" />
        <hr />
        <CheckPicker placement="leftStart" 
          placeholder="leftStart" />
        <CheckPicker placement="leftEnd" 
          placeholder="leftEnd" />
        <hr />
        <CheckPicker placement="rightStart" 
          placeholder="rightStart" />
        <CheckPicker placement="rightEnd" 
          placeholder="rightEnd" />
        <hr />
        <CheckPicker placement="bottomStart"
          placeholder="bottomStart" />
        <CheckPicker placement="bottomEnd" 
          placeholder="bottomEnd" />
      </div>
    </div>
  );
}
  
export default App;


Step to Run Application: Run the application using the following command from the project’s root directory.

npm start

Output:

 

Example 2: We are passing values like “auto”,”autoVerticalStart”,”autoVerticalEnd”,”autoHorizontalStart”, and “autoHorizontalEnd” to the placement prop.

App.js




import { CheckPicker } from "rsuite";
import "rsuite/dist/rsuite.min.css";
  
function App() {
  const style = {
    textAlign: "center",
  };
  return (
    <div className="App">
      <h4> React Suite CheckPicker Placement </h4>
      <div style={style}>
        <CheckPicker placement="auto" placeholder="auto" />
        <hr />
        <CheckPicker
          placement="autoVerticalStart"
          placeholder="autoVerticalStart"
        />
        <CheckPicker
          placement="autoVerticalEnd"
          placeholder="autoVerticalEnd"
        />
        <hr />
        <CheckPicker
          placement="autoHorizontalStart"
          placeholder="autoHorizontalStart"
        />
        <CheckPicker
          placement="autoHorizontalEnd"
          placeholder="autoHorizontalEnd"
        />
        <hr />
      </div>
    </div>
  );
}
  
export default App;


Step to Run Application: Run the application using the following command from the project’s root directory.

npm start

Output:

 

Reference: https://rsuitejs.com/components/check-picker/#placement

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

Recent Comments