Open In App

React Suite CheckPicker 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 <Checkpicker> props. <Checkpicker> component is used to select multiple options or to select a group of data items.



Checkpicker Props:

Syntax:



import { CheckPicker } from "rsuite";

Function App() {
return (
  <CheckPicker value={value} onChange={setValue} data={data} />
);
}

Creating React Application And Installing Module:

Step 1: Create a React application using the given command:

npm create-react-app projectname

Step 2: After creating your project, move to it using the given command:

cd projectname

Step 3: Now Install the rsuite node package using the given command:

npm install rsuite

Project Structure: Now your project structure should look like the following:

 

Example 1: Below example demonstrates the data, size, appearance, and placeholder checkpicker props.




import "rsuite/dist/rsuite.min.css";
import { CheckPicker } from "rsuite/";
  
export default function App() {
  
  // Sample courses data 
  const data = [{
    "label": "Sorting",
    "value": "Sorting",
  },
  {
    "label": "Searching",
    "value": "Searching",
  },
  {
    "label": "Greedy",
    "value": "Greedy",
  },
  {
    "label": "Dynamic Programming",
    "value": "DP",
  },
  {
    "label": "Backtracking",
    "value": "Backtracking",
  },
  ]
  
  return (
    <center>
      <div>
        <h2>GeeksforGeeks</h2>
        <h4 style={{ color: "green" }}>
          React Suite CheckPicker Props
        </h4>
  
        <div style={{ marginTop: 20, width: 800 }}>
        <CheckPicker 
          data={data}
          size="lg"
          appearance="subtle"
          placeholder="Select Algorithms"
        />
        </div>
      </div>
    </center>
  );
}

Output:

 

Example 2: Another example demonstrating the sticky, defaultValue, and disabledOptionValues checkpicker props.




import "rsuite/dist/rsuite.min.css";
import { CheckPicker } from "rsuite/";
  
export default function App() {
  
  // Sample courses data 
  const data = [{
    "label": "Sorting",
    "value": "Sorting",
  },
  {
    "label": "Searching",
    "value": "Searching",
  },
  {
    "label": "Greedy",
    "value": "Greedy",
  },
  {
    "label": "Dynamic Programming",
    "value": "DP",
  },
  {
    "label": "Backtracking",
    "value": "Backtracking",
  },
  ]
  
  return (
    <center>
      <div>
        <h2>GeeksforGeeks</h2>
        <h4 style={{ color: "green" }}>
          React Suite CheckPicker Props
        </h4>
  
        <div style={{ marginTop: 20, width: 800 }}>
        <CheckPicker 
          sticky
          data={data}
          defaultValue={['Greedy', 'Sorting']}
          disabledItemValues={['Backtracking']}
          placeholder="Select Algorithms"
        />
        </div>
      </div>
    </center>
  );
}

Output:

 

Reference: https://rsuitejs.com/components/check-picker/#code-lt-check-picker-gt-code


Article Tags :