I have a Drawer component with 3 items. On click of 3rd item it should display new component with new Drawer, it should not be nested .

2 Answers 30 Views
Drawer
Nikhil
Top achievements
Rank 1
Nikhil asked on 14 Mar 2025, 08:54 PM
I have a Drawer component with 3 items.

Item1 
Item2
Item3

Item1, Item2 should render insider DrawerContent

but on Item3 I want to load component that has its own routing, basicallly completily new component and new Drawer component

Kindly help.



2 Answers, 1 is accepted

Sort by
0
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
answered on 17 Mar 2025, 11:51 AM

The requirements you have may not follow the best UX guidelines, as it could lead to a confusing user experience. For example, once Item3 is loaded with its own DrawerContent, how would the user navigate back to the original Drawer component with the initial 3 items?

I would recommend keeping a single Drawer, and when Item3 is selected, display its related content (e.g., items 3.1, 3.2, 3.3) in a TabStrip or similar UI component.

That said, your requirements could also be implemented with nested routes and conditional rendering. This approach would check the current path to determine which Drawer component should be displayed.

Regards,
Anislav Atanasov

0
Yanko
Telerik team
answered on 18 Mar 2025, 05:11 PM

Hello, Nikhil,

Yes, you can render a different component outside the drawer for `item3` by moving the route for it outside the DrawerContainer and wrapping the DrawerContainer in a separate Route. This way you can render `item3` separately from the DrawerContainer. I prepared an example demonstrating the above approach, that you can customize and extend with another Drawer for the `item3` component to meet your requirements:

 The tricky part in this scenario is providing the correct routes to each page and managing where to render the DrawerContainer.

Feel free to ask further questions.

Regards,
Yanko
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!

Tags
Drawer
Asked by
Nikhil
Top achievements
Rank 1
Answers by
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Yanko
Telerik team
Share this question
or