Open In App

React Suite CheckTreePicker 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 CheckTreePicker Props. CheckTreePicker is used as multiple selectors for the selection of multiple complex data structures.



CheckTreePicker Props:

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 demonstrate the size, placeholder, and cascade props of CheckTreePicker.




import { CheckTreePicker } from "rsuite";
import "rsuite/dist/rsuite.min.css";
  
export default function App() {
    const data = [
        {
            label: "Algorithms",
            value: 1,
            children: [
                {
                    label: "Searching",
                    value: 2,
                    children: [
                        {
                            label: "Binary Search",
                            value: 3,
                        },
                        {
                            label: "Linear Search",
                            value: 4,
                        },
                    ],
                },
                {
                    label: "Sorting",
                    value: 5,
                    children: [
                        {
                            label: "Selection Sort",
                            value: 6,
                        },
                        {
                            label: "Bubble Sort",
                            value: 7,
                        },
                        {
                            label: "Merge Sort",
                            value: 8,
                        },
                    ],
                },
            ],
        },
    ];
  
    return (
        <center>
            <div>
                <h2>GeeksforGeeks</h2>
                <h4 style={{ color: "green" }}>
                    React Suite CheckTreePicker Props</h4>
                <div style={{ marginTop: 20, width: 800 }}>
                    <CheckTreePicker
                        size="md"
                        placeholder="Select Algorithms"
                        data={data}
                        cascade={false}
                    />
                </div>
            </div>
        </center>
    );
}

Output:

 

Example 2: Below example demonstrate the placement, appearance, and disabledItemValues props of CheckTreePicker.




import { CheckTreePicker } from "rsuite";
import "rsuite/dist/rsuite.min.css";
  
export default function App() {
    const data = [
        {
            label: "Algorithms",
            value: 1,
            children: [
                {
                    label: "Searching",
                    value: 2,
                    children: [
                        {
                            label: "Binary Search",
                            value: 3,
                        },
                        {
                            label: "Linear Search",
                            value: 4,
                        },
                    ],
                },
                {
                    label: "Sorting",
                    value: 5,
                    children: [
                        {
                            label: "Selection Sort",
                            value: 6,
                        },
                        {
                            label: "Bubble Sort",
                            value: 7,
                        },
                        {
                            label: "Merge Sort",
                            value: 8,
                        },
                    ],
                },
            ],
        },
    ];
  
    return (
        <center>
            <div>
                <h2>GeeksforGeeks</h2>
                <h4 style={{ color: "green" }}>
                    React Suite CheckTreePicker Props</h4>
                <div style={{ marginTop: 20, width: 800 }}>
                    <CheckTreePicker
                        placeholder="Select Algorithms"
                        data={data}
                        placement="bottomStart"
                        appearance="subtle"
                        disabledItemValues={[4, 7, 8]}
                    />
                </div>
            </div>
        </center>
    );
}

Output:

 

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


Article Tags :