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.CheckTreePicker is supported in multiple selectors for multiple selections of complex data structures.
React Suite CheckTreePicker Size helps the user to create CheckTreePicker of different sizes. It provides four sizes; namely lg, md, sm, and xs
Syntax:
<CheckTreePicker size="Class Name" data={data} />
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:
cd foldername
Step 3: After creating the ReactJS application, Install the required module using the following command:
npm install rsuite
Project Structure: It will look like the following.
Example: In this example, we will show large and medium CheckTreePicker.
- App.js: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.
Javascript
import react from 'react' ; import CheckTreePicker from 'rsuite/CheckTreePicker' ; import 'rsuite/dist/rsuite.min.css' ; export default function App() { // Sample Options const data = [ { "label" : "Madhya Pradesh" , "value" : 1, "children" : [ { "label" : "Mhow" , "value" : 2 }, { "label" : "Indore" , "value" : 3, "children" : [ { "label" : "Vijay Nagar" , "value" : 4 }, { "label" : "Rajiv Gandhi Square" , "value" : 5 }, { "label" : "MR 10" , "value" : 6 }, ] }, ] } ] return ( <div className= "App" > <h1 style={{ color: 'green' }} > neveropen</h1> <h3>React Suite CheckTreePicker Size</h3> <CheckTreePicker size= "lg" placeholder= "GFG_Large_CheckTreePicker" data={data} /> <CheckTreePicker size= "md" placeholder= "GFG_Medium_CheckTreePicker" data={data} /> </div> ); } |
Step to Run Application: Run the application using the following command from the root directory of the project:
npm start
Output:
Example 2: In this example, we will show small and extra-small CheckTreePicker
Javascript
import react from 'react' ; import CheckTreePicker from 'rsuite/CheckTreePicker' ; import 'rsuite/dist/rsuite.min.css' ; export default function App() { // Sample Options const data = [ { "label" : "Madhya Pradesh" , "value" : 1, "children" : [ { "label" : "Mhow" , "value" : 2 }, { "label" : "Indore" , "value" : 3, "children" : [ { "label" : "Vijay Nagar" , "value" : 4 }, { "label" : "Rajiv Gandhi Square" , "value" : 5 }, { "label" : "MR 10" , "value" : 6 }, ] }, ] } ] return ( <div className= "App" > <h1 style={{ color: 'green' }} >neveropen</h1> <h3>React Suite CheckTreePicker Size</h3> <CheckTreePicker size= "sm" placeholder= "GFG_Small_CheckTreePicker" data={data} /> <CheckTreePicker size= "xs" placeholder= "GFG_Xsmall_CheckTreePicker" data={data} /> </div> ); } |
Output:
Reference: https://rsuitejs.com/components/check-tree-picker/#size