Layout
TwSidebar
TwSidebar is a Blazor sidebar for navigation. Build it from SidebarContent markup or data-driven NavigationItems, with IsSearchable and a collapsible layout.
Last updated
Item content
Use
NavigationItemContent to render your own content after the label of the items generated from NavigationItems, such as a badge or a count. The template is called for every item and receives the NavigationItem as its context, so render nothing for the items that need no extra content. This documentation site uses it for the "New" badges in its own sidebar.
It works on parent items as well as links: on a parent item the content sits between the label and the chevron, as on "Content" below. A badge on a parent can stand for everything inside it, in place of a badge on every child.
Identify items by their
Id or Href, not by reference, because the template receives a copy of the item while the sidebar is being searched. The content is placed inside the item's link or toggle button, so keep it non-interactive; any text in it is read out as part of the item's name. The wrapper around the content is styled by NavigationItemContent on TwSidebarTheme.
Theme configuration
Styling is controlled by
TwBlazorTheme.Components (a TwSidebarTheme), configured via the
AddTwBlazor() options callback described on the Get Started page.
Every property is a set of Tailwind classes, so changes are picked up by your own Tailwind build.
Full reference: TwSidebarTheme on the API docs.