import "rsuite/dist/rsuite.min.css" ;
import { Cascader } from "rsuite" ;
import { useState } from "react" ;
const customData = [
{
label: "Data Structures" ,
value: 1,
children: [
{
label: "Queue" ,
value: 2,
children: [
{
label: "Priority Queue" ,
value: 3,
},
{
label: "FIFO Queue" ,
value: 4,
},
],
},
{
label: "Linked List" ,
value: 5,
children: [
{
label: "Circular" ,
value: 6,
},
{
label: "Double" ,
value: 7,
},
{
label: "Single" ,
value: 8,
},
],
},
],
},
{
label: "Algorithms" ,
value: 9,
children: [
{
label: "Search" ,
value: 2,
children: [
{
label: "Binary Search" ,
value: 3,
},
{
label: "Linear Search" ,
value: 4,
},
],
},
{
label: "Sorting" ,
value: 5,
children: [
{
label: "Bubble Sort" ,
value: 6,
},
{
label: "Selection Sort" ,
value: 7,
},
{
label: "Insertion Sort" ,
value: 8,
},
],
},
],
},
]
export default function App() {
const [value, setValue] = useState(3);
return (
<div>
<div style={
{
textAlign: "center"
}}>
<h2>GeeksforGeeks</h2>
<h4 style={{ color: "green" }}>
React Suite Cascader Controlled
</h4>
</div>
<div style={
{
padding: 20,
textAlign: "center"
}}>
<div>
<Cascader
value={value}
onChange={setValue}
style={{ width: 300 }}
data={customData}
/>
</div>
</div>
</div>
);
}
|