diff --git a/knowledge-base/drawer-add-expand-collapse-handle.md b/knowledge-base/drawer-add-expand-collapse-handle.md new file mode 100644 index 0000000000..3eb2153d4b --- /dev/null +++ b/knowledge-base/drawer-add-expand-collapse-handle.md @@ -0,0 +1,100 @@ +--- +title: Add Expand/Collapse Handle to Toggle the Drawer +description: This demo shows how to add expand/collapse handle to toggle the Telerik Blazor Drawer. +type: how-to +page_title: Add Expand/Collapse Handle to Toggle the Drawer +slug: drawer-kb-add-expand-collapse-handle +position: +tags: telerik, blazor, drawer, expand, collapse, handle +ticketid: 1527830 +res_type: kb +--- + +## Environment + + + + + + + +
ProductDrawer for Blazor
+ + +## Description + +How to add a handle feature within the rendered Drawer component that would expand and collapse the component? + +## Solution + +To achieve the desired result you can try the following: + +* Add a Telerik Button +* Toggle the Drawer on click of that button +* Use custom CSS to adjust the button's appearance, position, transition etc. + +The example below demonstrates the described approach: + +````CSHTML +@* Add Expand/Collapse handle to toggle the Drawer *@ + + + + + + + + @* Place your contents here - it can be as simple as text, it can be conditional components or components that take the selected item as a parameter, or even the @Body tag for navigation if you place the drawer high enough in the project layout hierarchy *@ +
+ Selected Item: @SelectedItem?.Text +
+
+
+ + +@code { + public bool ExpandedDrawer { get; set; } + + TelerikDrawer DrawerRef { get; set; } + + DrawerItem SelectedItem { get; set; } + + IEnumerable Data { get; set; } = + new List + { + new DrawerItem { Text = "Counter", Icon = "plus"}, + new DrawerItem { Text = "FetchData", Icon = "grid-layout"} + }; + + public class DrawerItem + { + public string Text { get; set; } + public string Icon { get; set; } + } +} +````