I would like to be able to create Drawer Items in markup, not programmatically in code. Similar to https://feedback.telerik.com/blazor/1433539-declare-the-menu-items-in-markup-without-code. Ideally, I would like to have an implementation similar to MudBlazor's Drawer: https://www.mudblazor.com/components/drawer#usage.
Example:
<TelerikDrawer>
<DrawerSidebar>
<DrawerItem>
<NavLink />
</DrawerItem>
<DrawerItem>
<NavLink />
</DrawerItem>
</DrawerSidebar>
<DrawerContent>
@Body
</DrawerContent>
</TelerikDrawer>
Alternative Example:
<TelerikDrawer>
<TelerikMenu />
</TelerikDrawer>
Hi Isaac,
Thank you for sharing in such detail your experience with the current possibilities of the Drawer component.
After carefully reviewing the provided information with the team, we agreed that the ability to declare drawer items in markup is a valuable feature request. Therefore, I am marking this item as Unplanned.
Regards,
Hristian Stefanov
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hi Hristian,
Thanks for the response! I would like to create DrawerItems using strictly markup. While you can achieve a similar approach using Template or ItemTemplate, you cannot use strictly markup.
Explanation
Template and ItemTemplate are designed to act sort of like factories that build the markup based on the Data parameter. This requires you to define Data in code. Also, if you need a hierarchical Drawer, you have to add extra code to enable that functionality. This is not strictly markup. You could opt to not define Data at all and use Template (which I have), but you still have to add code to enable hierarchical functionality. Furthermore, you also have to define TItem even though there is no Data, which clutters the file as it takes up space, but adds nothing of value to me as the developer.
Request
Overall, I would like the Drawer component to not have a Data parameter at all. Instead of passing in Data, you would pass in strictly markup. I would also like the Drawer component to support hierarchical menus without the need to add extra code or use Template, but I have another feature request for that.
Reason
The reason I make this request is for a better developer experience. For me, it makes more sense to be able to use strictly markup because you can directly see the markup rather than seeing a list of data that's passed into something that builds markup. This leads to quicker development and maintenance.
As an example, lets assume we have to build a complex sidebar menu that is hierarchical, has some links that open new tabs, and requires authentication. I have to add support for all those features into my list of data and the Drawer Template that builds the markup. So, I have to add more properties to my list of data and add conditionals to the Drawer Template. With the extra properties and conditionals, it becomes even more difficult to visualize the sidebar menu when I'm developing and maintaining the sidebar menu. If I could just strictly use markup, I can add in the functionality only where its needed without adding extra properties to a list of data or using conditionals. As a result, I can very easily determine which items on the sidebar menu are authenticated or open in a new tab at a glance.
Furthermore, other popular Blazor component libraries follow the implementation I'm requesting. If you look at MudBlazor, SyncFusion, and DevExpress, all of there Drawer/Sidebar components do not have a Data (or comparable) parameter. Instead, they strictly use markup. This is what I would like to see:
Hi Isaac,
You can achieve a similar effect using the Drawer ItemTemplate, which allows you to control the rendering of the items and include the markup directly.
The Drawer ItemTemplate feature offers a way to define your items declaratively within the <ItemTemplate> tag. This approach gives you the flexibility to "hardcode" the markup as needed.
Please let me know if this meets your needs. If not, I'd appreciate it if you could share the reason for the template approach not being suitable and assist you further.
Regards,
Hristian Stefanov
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.