# Nav
**Also known as:** Tree, TreeView
## Description
A navigation pane (Nav) provides links to the main areas of an app or site, and can also be used as a TreeView to show parent-child data in a tree. It renders a hierarchy of any depth, keeps its selection in sync with the current URL (exact, prefix, wildcard or regex) or leaves it to the app, groups items under headers, shrinks to a rail of icons, and is fully operable from the keyboard with the tree-view keys.
## Parameters
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| Accent | `BitColor?` | null | The accent color of the nav: the background of the hovered and the selected item. A background, foreground or border role tints the item, a semantic role fills it and recolors its content. An explicit value wins over the --bit-Nav-* hover, pressed and selected variables; left unset, the nav takes the PrimaryBackground accent unless they say otherwise. |
| AllExpanded | `bool` | false | Expands all items when they are first rendered. Items that arrive later are expanded as they arrive, while the items already on screen keep whatever the user has expanded or collapsed in the meantime. |
| AutoReorderOptions | `bool` | false | Keeps the order of the options (what the arrow keys, Home, End and type-ahead walk), at every level of the tree, in sync with their markup order when options are added, removed or reordered after the first render. Opt-in, since it reads the DOM order back after each change. |
| ChevronDownIcon | `BitIconInfo?` | null | The icon for the chevron-down element of each nav item. Takes precedence over ChevronDownIconName when both are set. |
| ChevronDownIconName | `string?` | null | The custom icon name of the chevron-down element of each nav item. |
| ChildContent | `RenderFragment?` | null | Items to render as children. |
| Classes | `BitNavClassStyles?` | null | Custom CSS classes for different parts of the BitNav component. |
| CollapseAriaLabel | `string?` | null | The default aria-label of the expand/collapse button of an expanded item: the chevron of a parent that has a URL, or a group header. The CollapseAriaLabel of the item takes precedence over this value, and when neither is provided the text of the item is used. |
| Color | `BitColor?` | null | The general color of the nav that is only used for colored parts like icons. An explicit value wins over --bit-Nav-icon-color and --bit-Nav-indicator-color; left unset, the nav is primary unless they say otherwise. |
| DefaultSelectedItem | `TItem?` | null | The initially selected item in manual mode. |
| ExpandAriaLabel | `string?` | null | The default aria-label of the expand/collapse button of a collapsed item: the chevron of a parent that has a URL, or a group header. The ExpandAriaLabel of the item takes precedence over this value, and when neither is provided the text of the item is used. |
| FitWidth | `bool` | false | Renders the nav in a width to only fit its content. |
| FullWidth | `bool` | false | Renders the nav in full width of its container element. |
| HeaderTemplate | `RenderFragment<TItem>?` | null | Used to customize how content inside the group header is rendered. |
| HeaderTemplateRenderMode | `BitNavItemTemplateRenderMode` | BitNavItemTemplateRenderMode.Normal | The render mode of the custom HeaderTemplate. |
| IconOnly | `bool` | false | Only renders the icon of each nav item. |
| IndentPadding | `int` | 27 | The width in px of the chevron, which the items without children keep as padding in its place so every text lines up. |
| IndentReversedPadding | `int` | 4 | The indentation padding in px for items in reversed mode. |
| IndentValue | `int` | 16 | The indentation value in px for each level of depth of child item. |
| Items | `IList<TItem>` | new List<TItem>() | A collection of items to display in the BitNav component. |
| ItemSuffixTemplate | `RenderFragment<TItem>?` | null | Used to render custom content at the end of every item, after its text and ahead of its badge, while the item keeps its default content. The SuffixTemplate of an item wins over it. It is rendered inside the item's anchor (or button), so it holds content to look at and never a control of its own; group headers, separators, items replaced by their template and the IconOnly nav do not render it. |
| ItemTemplate | `RenderFragment<TItem>?` | null | Used to customize how content inside the item is rendered. |
| ItemTemplateRenderMode | `BitNavItemTemplateRenderMode` | BitNavItemTemplateRenderMode.Normal | The render mode of the custom ItemTemplate. |
| Match | `BitNavMatch?` | null | The URL matching behavior of the nav in the Automatic mode. The Match of an item takes precedence over this value, and when neither is provided the URL of an item has to match the current one exactly. |
| Mode | `BitNavMode` | BitNavMode.Automatic | Determines how the navigation will be handled. |
| NameSelectors | `BitNavNameSelectors<TItem>?` | null | Names and selectors of the custom input type properties. |
| NewTabHint | `string?` | null | Replaces the visually hidden "(opens in a new tab)" an item whose Target is _blank is announced with, e.g. to translate it. An empty value removes it. |
| NoCollapse | `bool` | false | Keeps every item expanded and hides the collapse/expand buttons together with the space they reserve at the start of each item. |
| NoNewTabHint | `bool` | false | Stops the items whose Target is _blank from announcing that they open a new tab - only for where a visible label or heading already says so. |
| OnItemClick | `EventCallback<TItem>` | | Callback invoked when an item is clicked. |
| OnItemToggle | `EventCallback<TItem>` | | Callback invoked when an item is expanded or collapsed. |
| OnSelectItem | `EventCallback<TItem>` | | Callback invoked when an item is selected. |
| Options | `RenderFragment?` | null | Alias of ChildContent. |
| RenderType | `BitNavRenderType` | BitNavRenderType.Normal | The way to render nav items. |
| Reselectable | `bool` | false | Enables recalling the select events when the same item is selected. |
| ReversedChevron | `bool` | false | Reverses the location of the expander chevron. |
| SelectedItem | `TItem?` | null | Selected item to show in the BitNav. |
| Size | `BitSize?` | null | The size of the nav items. An explicit value wins over the --bit-Nav-* size variables; left unset, the nav is medium unless they say otherwise. |
| SingleExpand | `bool` | false | Enables the single-expand mode in the BitNav. |
| Styles | `BitNavClassStyles?` | null | Custom CSS styles for different parts of the BitNav component. |
| AriaLabel | `string?` | null | Gets or sets the accessible label for the component, used by assistive technologies. |
| Class | `string?` | null | Gets or sets the CSS class name(s) to apply to the rendered element. |
| Dir | `BitDir?` | null | Gets or sets the text directionality for the component's content. |
| Disabled | `bool` | false | Gets or sets a value indicating whether the component is disabled and cannot respond to user interaction. |
| ForceAnimation | `bool` | false | Gets or sets a value indicating whether the component's animations play at their full duration even when reduced motion is requested. |
| HtmlAttributes | `Dictionary<string, object>` | new Dictionary<string, object>() | Captures additional HTML attributes to be applied to the rendered element, in addition to the component's parameters. An attribute written on the component wins over an entry of the same name. |
| Id | `string?` | null | Gets or sets the unique identifier for the component's root element. |
| Style | `string?` | null | Gets or sets the CSS style string to apply to the rendered element. |
| TabIndex | `string?` | null | Gets or sets the tab order index for the component when navigating with the keyboard. |
| Visibility | `BitVisibility` | BitVisibility.Visible | Gets or sets the visibility state (visible, hidden, or collapsed) of the component. |
## Public Members
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| CollapseAll | `Action<TItem? item>` | | Collapses all items and children. |
| CollapseItem | `Func<TItem, Task>` | | Collapses an item, and does nothing when it is already collapsed. |
| ExpandAll | `Action<TItem? item>` | | Expands all items and children in non-SingleExpand mode. |
| ExpandItem | `Func<TItem, Task>` | | Expands an item, and does nothing when it is already expanded. |
| FocusItem | `Func<TItem, ValueTask>` | | Moves the focus to an item of the nav, opening the branches it is nested in when it is not rendered yet. |
| IsItemExpanded | `Func<TItem, bool>` | | Whether the children of an item are currently shown, which is always the case while NoCollapse is set. |
| SelectItem | `Func<TItem?, Task>` | | Selects an item programmatically, exactly like a click on that item would in the manual mode. |
| ToggleItem | `Func<TItem, Task>` | | Toggles an item. |
| UniqueId | `Guid` | Guid.NewGuid() | Gets the readonly unique identifier for the component's root element, assigned when the component instance is constructed. |
| RootElement | `ElementReference` | | Gets the reference to the root HTML element associated with this component. |
## Enums
### BitColor Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Primary | 0 | Primary general color. |
| Secondary | 1 | Secondary general color. |
| Tertiary | 2 | Tertiary general color. |
| Info | 3 | Info general color. |
| Success | 4 | Success general color. |
| Warning | 5 | Warning general color. |
| SevereWarning | 6 | SevereWarning general color. |
| Error | 7 | Error general color. |
| PrimaryBackground | 8 | Primary background color. |
| SecondaryBackground | 9 | Secondary background color. |
| TertiaryBackground | 10 | Tertiary background color. |
| PrimaryForeground | 11 | Primary foreground color. |
| SecondaryForeground | 12 | Secondary foreground color. |
| TertiaryForeground | 13 | Tertiary foreground color. |
| PrimaryBorder | 14 | Primary border color. |
| SecondaryBorder | 15 | Secondary border color. |
| TertiaryBorder | 16 | Tertiary border color. |
### BitNavMatch Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Exact | 0 | Specifies that the item should be active when it matches exactly the current URL. |
| Prefix | 1 | Specifies that the item should be active when it matches any prefix of the current URL. |
| Regex | 2 | Specifies that the item should be active when its provided regex matches the current URL. |
| Wildcard | 3 | Specifies that the item should be active when its provided wildcard matches the current URL. |
### BitNavMode Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Automatic | 0 | The component follows the browser: it selects the item whose URL points at the page the app currently sits on, and it re-selects on every navigation. |
| Manual | 1 | The selection is driven by clicks and by the SelectedItem binding instead of by the current URL, which is what a component that switches between the panels of a single page needs. |
### BitNavRenderType Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Normal | 0 | All items will be rendered normally only based on their own properties. |
| Grouped | 1 | Root elements are rendered in a specific way that resembles a grouped list of items. |
### BitNavAriaCurrent Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Page | 0 | Represents the current page within a set of pages. |
| Step | 1 | Represents the current step within a process. |
| Location | 2 | Represents the current location within an environment or context. |
| Date | 3 | Represents the current date within a collection of dates. |
| Time | 4 | Represents the current time within a set of times. |
| True | 5 | Represents the current item within a set, without saying which kind of set it is. |
### BitNavItemTemplateRenderMode Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Normal | 0 | Renders the template inside the anchor (or the button) the item is, so the item keeps its click, its focus and its place in the keyboard navigation. |
| Replace | 1 | Replaces the anchor (or the button) the item is with the template, which is what an item that is a control of its own needs. The template owns its clicks, its focus and its accessible name, and the item is left out of the keyboard navigation. |
### BitLinkRels Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Alternate | 1 | Provides a link to an alternate representation of the document. (i.e. print page, translated or mirror) |
| Author | 2 | Provides a link to the author of the document. |
| Bookmark | 4 | Permanent URL used for bookmarking. |
| External | 8 | Indicates that the referenced document is not part of the same site as the current document. |
| Help | 16 | Provides a link to a help document. |
| License | 32 | Provides a link to licensing information for the document. |
| Next | 64 | Provides a link to the next document in the series. |
| NoFollow | 128 | Links to an unendorsed document, like a paid link. ("NoFollow" is used by Google, to specify that the Google search spider should not follow that link) |
| NoOpener | 256 | Requires that any browsing context created by following the hyperlink must not have an opener browsing context. |
| NoReferrer | 512 | Makes the referrer unknown. No referrer header will be included when the user clicks the hyperlink. |
| Prev | 1024 | The previous document in a selection. |
| Search | 2048 | Links to a search tool for the document. |
| Tag | 4096 | A tag (keyword) for the current document. |
| Me | 8192 | Indicates that the linked document represents the person who owns the current content. (used for identity verification) |
| Opener | 16384 | Requires that any browsing context created by following the hyperlink keeps its opener browsing context. (reverses the implicit noopener modern browsers apply to _blank targets) |
| PrivacyPolicy | 32768 | Links to the privacy policy that applies to the current document. (rendered as privacy-policy) |
| Sponsored | 65536 | Marks the link as an advertisement or paid placement, so search engines do not count it as an organic endorsement. |
| TermsOfService | 131072 | Links to the terms of service that apply to the current document. (rendered as terms-of-service) |
| Ugc | 262144 | Marks the link as user-generated content, like forum posts or comments, for search engines. |
### BitSize Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Small | 0 | The small size. |
| Medium | 1 | The medium size. |
| Large | 2 | The large size. |
### BitVisibility Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Visible | 0 | The content of the component is visible. |
| Hidden | 1 | The content of the component is hidden, but the space it takes on the page remains (visibility:hidden). |
| Collapsed | 2 | The component is hidden (display:none). |
### BitDir Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Ltr | 0 | Ltr (left to right) is to be used for languages that are written from the left to the right (like English). |
| Rtl | 1 | Rtl (right to left) is to be used for languages that are written from the right to the left (like Arabic). |
| Auto | 2 | Auto lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then applies that directionality to the whole element. |
## Sub Classes
### BitNavItem Properties
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| AriaCurrent | `BitNavAriaCurrent` | BitNavAriaCurrent.Page | Aria-current token for active nav item. Must be a valid token value, and defaults to 'page'. |
| AriaLabel | `string?` | null | The accessible name of the nav item, in place of its text. It also names a group header, whose CollapseAriaLabel/ExpandAriaLabel only apply when it is not set. |
| Badge | `string?` | null | The badge text to render after the text of the nav item, for a count or a short status ("3", "New"). The item keeps its icon, its text and its states; a template in the Normal mode replaces the default icon and text, but the badge remains. Wins over Dot. Group headers, separators and a template in the Replace mode do not render it; the IconOnly nav pins it to the corner of the icon. |
| BadgeAriaLabel | `string?` | null | The accessible description of the badge (or the dot) of the nav item, folded into its accessible name ("Inbox (3 unread)"). It falls back to the Badge text, and a Dot is only announced while this is set. |
| Class | `string?` | null | Custom CSS class for the nav item. |
| ChildItems | `List<BitNavItem>` | [] | A list of items to render as children of the current nav item. |
| CollapseAriaLabel | `string?` | null | Aria label of the toggle button when the nav item is expanded and can be collapsed. |
| Data | `object?` | null | The custom data for the nav item to provide additional state. |
| Description | `string?` | null | The description for the nav item. |
| Dot | `bool` | false | Renders a small dot after the text of the nav item, to mark it as needing attention without showing a number. Ignored while Badge is set. |
| ExpandAriaLabel | `string?` | null | Aria label of the toggle button when the nav item is collapsed and can be expanded. |
| ForceAnchor | `bool` | false | Forces an anchor element render instead of button. |
| Icon | `BitIconInfo?` | null | The icon to render next to the nav item. Takes precedence over IconName when both are set. |
| IconName | `string?` | null | Name of an icon to render next to the nav item. |
| IsDisabled | `bool` | false | Whether or not the nav item is disabled. |
| IsExpanded | `bool` | false | Whether or not the nav item is in an expanded state. |
| IsSeparator | `bool` | false | Indicates that the nav item should render as a separator. |
| Key | `string?` | null | A unique value to use as a key or id of the nav item. |
| Match | `BitNavMatch?` | null | Gets or sets a value representing the URL matching behavior of the nav item. |
| Rel | `BitLinkRels?` | null | The rel attribute of the link of the nav item. A Target of _blank adds noopener to it, unless it already says NoOpener, NoReferrer or Opener; noreferrer is never added on its own. |
| Style | `string?` | null | Custom CSS style for the nav item. |
| SuffixTemplate | `RenderFragment<BitNavItem>?` | null | The custom template to render at the end of the nav item, after its text and ahead of its badge, while the item keeps its default content. Wins over the ItemSuffixTemplate of the nav. It holds content to look at, never a control of its own, and the IconOnly nav does not render it. |
| Target | `string?` | null | Link target, specifies how to open the nav item's link. |
| Template | `RenderFragment<BitNavItem>?` | null | The custom template for the nav item to render. |
| TemplateRenderMode | `BitNavItemTemplateRenderMode` | BitNavItemTemplateRenderMode.Normal | The render mode of the nav item's custom template. |
| Text | `string` | string.Empty | Text to render for the nav item. |
| Title | `string?` | null | Text for the tooltip of the nav item. |
| Url | `string?` | null | The nav item's link URL. |
| AdditionalUrls | `IEnumerable<string>?` | null | Alternative URLs to be considered when auto mode tries to detect the selected nav item by the current URL. |
### BitNavOption Properties
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| AriaCurrent | `BitNavAriaCurrent` | BitNavAriaCurrent.Page | Aria-current token for active nav option. Must be a valid token value, and defaults to 'page'. |
| AriaLabel | `string?` | null | The accessible name of the nav option, in place of its text. It also names a group header, whose CollapseAriaLabel/ExpandAriaLabel only apply when it is not set. |
| Badge | `string?` | null | The badge text to render after the text of the nav option, for a count or a short status ("3", "New"). The option keeps its icon, its text and its states; a template in the Normal mode replaces the default icon and text, but the badge remains. Wins over Dot. Group headers, separators and a template in the Replace mode do not render it; the IconOnly nav pins it to the corner of the icon. |
| BadgeAriaLabel | `string?` | null | The accessible description of the badge (or the dot) of the nav option, folded into its accessible name ("Inbox (3 unread)"). It falls back to the Badge text, and a Dot is only announced while this is set. |
| Class | `string?` | null | Custom CSS class for the nav option. |
| ChildContent | `RenderFragment?` | null | A list of options to render as children of the current nav option. |
| CollapseAriaLabel | `string?` | null | Aria label of the toggle button when the nav option is expanded and can be collapsed. |
| Data | `object?` | null | The custom data for the nav option to provide additional state. |
| Description | `string?` | null | The description for the nav option. |
| Dot | `bool` | false | Renders a small dot after the text of the nav option, to mark it as needing attention without showing a number. Ignored while Badge is set. |
| ExpandAriaLabel | `string?` | null | Aria label of the toggle button when the nav option is collapsed and can be expanded. |
| ForceAnchor | `bool` | false | Forces an anchor element render instead of button. |
| Icon | `BitIconInfo?` | null | The icon to render next to the nav option. Takes precedence over IconName when both are set. |
| IconName | `string?` | null | Name of an icon to render next to the nav option. |
| IsDisabled | `bool` | false | Whether or not the nav option is disabled. |
| IsExpanded | `bool` | false | Whether or not the nav option is in an expanded state. |
| IsSeparator | `bool` | false | Indicates that the nav option should render as a separator. |
| Key | `string?` | null | A unique value to use as a key or id of the nav option. |
| Match | `BitNavMatch?` | null | Gets or sets a value representing the URL matching behavior of the nav option. |
| Rel | `BitLinkRels?` | null | The rel attribute of the link of the nav option. A Target of _blank adds noopener to it, unless it already says NoOpener, NoReferrer or Opener; noreferrer is never added on its own. |
| Style | `string?` | null | Custom CSS style for the nav option. |
| SuffixTemplate | `RenderFragment<BitNavOption>?` | null | The custom template to render at the end of the nav option, after its text and ahead of its badge, while the option keeps its default content. Wins over the ItemSuffixTemplate of the nav. It holds content to look at, never a control of its own, and the IconOnly nav does not render it. |
| Target | `string?` | null | Link target, specifies how to open the nav option's link. |
| Template | `RenderFragment<BitNavOption>?` | null | The custom template for the nav option to render. |
| TemplateRenderMode | `BitNavItemTemplateRenderMode` | BitNavItemTemplateRenderMode.Normal | The render mode of the nav option's custom template. |
| Text | `string` | string.Empty | Text to render for the nav option. |
| Title | `string?` | null | Text for the tooltip of the nav option. |
| Url | `string?` | null | The nav option's link URL. |
| AdditionalUrls | `IEnumerable<string>?` | null | Alternative URLs to be considered when auto mode tries to detect the selected nav option by the current URL. |
### BitNavNameSelectors<TItem> Properties
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| AriaCurrent | `BitNameSelectorPair<TItem, BitNavAriaCurrent?>` | new(nameof(BitNavItem.AriaCurrent)) | The AriaCurrent field name and selector of the custom input class. |
| AriaLabel | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavItem.AriaLabel)) | The AriaLabel field name and selector of the custom input class. |
| Badge | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavItem.Badge)) | The Badge field name and selector of the custom input class. |
| BadgeAriaLabel | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavItem.BadgeAriaLabel)) | The BadgeAriaLabel field name and selector of the custom input class. |
| Class | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavItem.Class)) | The Class field name and selector of the custom input class. |
| ChildItems | `BitNameSelectorPair<TItem, List<TItem>?>` | new(nameof(BitNavItem.ChildItems)) | The ChildItems field name and selector of the custom input class. |
| CollapseAriaLabel | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavItem.CollapseAriaLabel)) | The CollapseAriaLabel field name and selector of the custom input class. |
| Data | `BitNameSelectorPair<TItem, object?>` | new(nameof(BitNavItem.Data)) | The Data field name and selector of the custom input class. |
| Description | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavItem.Description)) | The Description field name and selector of the custom input class. |
| Dot | `BitNameSelectorPair<TItem, bool?>` | new(nameof(BitNavItem.Dot)) | The Dot field name and selector of the custom input class. |
| ExpandAriaLabel | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavItem.ExpandAriaLabel)) | The ExpandAriaLabel field name and selector of the custom input class. |
| ForceAnchor | `BitNameSelectorPair<TItem, bool?>` | new(nameof(BitNavItem.ForceAnchor)) | The ForceAnchor field name and selector of the custom input class. |
| Icon | `BitNameSelectorPair<TItem, BitIconInfo?>` | new(nameof(BitNavItem.Icon)) | The Icon field name and selector of the custom input class. |
| IconName | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavItem.IconName)) | The IconName field name and selector of the custom input class. |
| IsDisabled | `BitNameSelectorPair<TItem, bool?>` | new(nameof(BitNavItem.IsDisabled)) | The IsDisabled field name and selector of the custom input class. |
| IsExpanded | `BitNameSelectorPair<TItem, bool?>` | new(nameof(BitNavItem.IsExpanded)) | The IsExpanded field name and selector of the custom input class. |
| IsSeparator | `BitNameSelectorPair<TItem, bool?>` | new(nameof(BitNavItem.IsSeparator)) | The IsSeparator field name and selector of the custom input class. |
| Key | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavItem.Key)) | The Key field name and selector of the custom input class. |
| Match | `BitNameSelectorPair<TItem, BitNavMatch?>` | new(nameof(BitNavItem.Match)) | The Match field name and selector of the custom input class. |
| Rel | `BitNameSelectorPair<TItem, BitLinkRels?>` | new(nameof(BitNavItem.Rel)) | The Rel field name and selector of the custom input class. |
| Style | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavItem.Style)) | The Style field name and selector of the custom input class. |
| SuffixTemplate | `BitNameSelectorPair<TItem, RenderFragment<TItem>?>` | new(nameof(BitNavItem.SuffixTemplate)) | The SuffixTemplate field name and selector of the custom input class. |
| Target | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavItem.Target)) | The Target field name and selector of the custom input class. |
| Template | `BitNameSelectorPair<TItem, RenderFragment<TItem>?>` | new(nameof(BitNavItem.Template)) | The Template field name and selector of the custom input class. |
| TemplateRenderMode | `BitNameSelectorPair<TItem, BitNavItemTemplateRenderMode?>` | new(nameof(BitNavItem.TemplateRenderMode)) | The TemplateRenderMode field name and selector of the custom input class. |
| Text | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavItem.Text)) | The Text field name and selector of the custom input class. |
| Title | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavItem.Title)) | The Title field name and selector of the custom input class. |
| Url | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavItem.Url)) | The Url field name and selector of the custom input class. |
| AdditionalUrls | `BitNameSelectorPair<TItem, IEnumerable<string>?>` | new(nameof(BitNavItem.AdditionalUrls)) | The AdditionalUrls field name and selector of the custom input class. |
### BitNavClassStyles Properties
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| Root | `string?` | null | Custom CSS classes/styles for the root element of the BitNav. |
| Description | `string?` | null | Custom CSS classes/styles for the description of the BitNav. |
| Header | `string?` | null | Custom CSS classes/styles for the group header button of the BitNav in the Grouped render type. |
| HeaderText | `string?` | null | Custom CSS classes/styles for the text of the group header of the BitNav in the Grouped render type. |
| Item | `string?` | null | Custom CSS classes/styles for the item of the BitNav. |
| SelectedItem | `string?` | null | Custom CSS classes/styles for the selected item of the BitNav. |
| ItemContainer | `string?` | null | Custom CSS classes/styles for the item container of the BitNav. |
| ItemBadge | `string?` | null | Custom CSS classes/styles for the item badge (or the dot) of the BitNav. |
| ItemIcon | `string?` | null | Custom CSS classes/styles for the item icon of the BitNav. |
| ItemText | `string?` | null | Custom CSS classes/styles for the item text of the BitNav. |
| ItemSuffix | `string?` | null | Custom CSS classes/styles for the item suffix of the BitNav, the end of the item that holds its suffix template and its badge. |
| SelectedItemContainer | `string?` | null | Custom CSS classes/styles for the selected item container of the BitNav. |
| ToggleButton | `string?` | null | Custom CSS classes/styles for the toggle button of the BitNav. |
| ToggleIcon | `string?` | null | Custom CSS classes/styles for the chevron icon inside the toggle button of the BitNav. |
| Separator | `string?` | null | Custom CSS classes/styles for the separator of the BitNav. |
### BitIconInfo Properties
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| Name | `string?` | null | Gets or sets the name of the icon. |
| BaseClass | `string?` | null | Gets or sets the base CSS class for the icon. For built-in Fluent UI icons, this defaults to "bit-icon". For external icon libraries like FontAwesome, you might set this to "fa" or leave empty. |
| Prefix | `string?` | null | Gets or sets the CSS class prefix used before the icon name. For built-in Fluent UI icons, this defaults to "bit-icon--". For external icon libraries, you might set this to "fa-" or leave empty. |
## CSS Variables
Public CSS custom properties read off the component's root. Set one on `:root` to restyle every instance, on any ancestor to restyle the ones inside it, or on the `Style` of one instance to restyle it and every instance nested inside it, which inherits the value too - a parameter changes one alone, as does the real CSS property on its `Style` / `Styles` when that property does not inherit (`opacity`); an inherited one (`color`, `font-family`) reaches the nested instances that do not set it themselves.
| Name | Default Value | Description |
| :--- | :------------ | :---------- |
| `--bit-Nav-color` | --bit-clr-fg-pri | Text and chevron color of an item at rest. |
| `--bit-Nav-icon-color` | --bit-clr-pri | Icon color of an item at rest, and of a hovered, pressed or selected one its own variable leaves unset (and of one under an explicit surface Accent). The Color parameter wins over it. |
| `--bit-Nav-description-color` | --bit-clr-fg-ter | Description color of an item at rest, and of a hovered, pressed or selected one its own variable leaves unset (and of one under an explicit surface Accent). |
| `--bit-Nav-disabled-color` | --bit-clr-fg-dis | Text, icon, description and chevron color of a disabled item (or of every item of a disabled nav). |
| `--bit-Nav-hover-background` | --bit-clr-bg-pri-hover | Background of a hovered item (pointer devices only); the selected item, and a collapsed branch that holds it, takes --bit-Nav-selected-hover-background instead. The Accent parameter wins over it. |
| `--bit-Nav-hover-color` | --bit-clr-fg-pri | Text and chevron color of a hovered item; the selected item, and a collapsed branch that holds it, takes --bit-Nav-selected-hover-color instead. The Accent parameter wins over it. |
| `--bit-Nav-hover-icon-color` | --bit-Nav-icon-color, then --bit-clr-pri | Icon color of a hovered item (pointer devices only); the selected item, and a collapsed branch that holds it, takes --bit-Nav-selected-hover-icon-color instead. The Accent and Color parameters win over it. |
| `--bit-Nav-hover-description-color` | --bit-Nav-description-color, then --bit-clr-fg-ter | Description color of a hovered item (pointer devices only); the selected item, and a collapsed branch that holds it, takes --bit-Nav-selected-hover-description-color instead. The Accent parameter wins over it. |
| `--bit-Nav-pressed-background` | --bit-clr-bg-pri-active | Background of an item while it is pressed (the one feedback a tap gets on a touch screen); the selected item, and a collapsed branch that holds it, takes --bit-Nav-selected-pressed-background instead. The Accent parameter wins over it. |
| `--bit-Nav-pressed-color` | --bit-Nav-hover-color, then --bit-clr-fg-pri (on a touch screen --bit-clr-fg-pri) | Text and chevron color of an item while it is pressed; the selected item, and a collapsed branch that holds it, takes --bit-Nav-selected-hover-color instead. Where the pointer can hover it falls back on the hovered color; on a touch screen, where no hover applies, on the default. The Accent parameter wins over it. |
| `--bit-Nav-pressed-icon-color` | --bit-Nav-hover-icon-color, then --bit-Nav-icon-color, then --bit-clr-pri (on a touch screen --bit-Nav-icon-color, then --bit-clr-pri) | Icon color of an item while it is pressed; the selected item, and a collapsed branch that holds it, takes --bit-Nav-selected-hover-icon-color instead. Where the pointer can hover it falls back on the hovered icon color; on a touch screen, where no hover applies, on the one at rest. The Accent and Color parameters win over it. |
| `--bit-Nav-pressed-description-color` | --bit-Nav-hover-description-color, then --bit-Nav-description-color, then --bit-clr-fg-ter (on a touch screen --bit-Nav-description-color, then --bit-clr-fg-ter) | Description color of an item while it is pressed; the selected item, and a collapsed branch that holds it, takes --bit-Nav-selected-hover-description-color instead. Where the pointer can hover it falls back on the hovered description color; on a touch screen, where no hover applies, on the one at rest. The Accent parameter wins over it. |
| `--bit-Nav-selected-background` | --bit-clr-bg-pri-active | Background of the selected item, and of a collapsed branch that holds it. The Accent parameter wins over it. |
| `--bit-Nav-selected-color` | --bit-clr-fg-pri | Text and chevron color of the selected item, and of a collapsed branch that holds it. The Accent parameter wins over it. |
| `--bit-Nav-selected-icon-color` | --bit-Nav-icon-color, then --bit-clr-pri | Icon color of the selected item, and of a collapsed branch that holds it - the one to move with --bit-Nav-selected-background when that is a vivid fill. The Accent and Color parameters win over it: an explicit Accent draws the icon in its own colors on its own fill (a semantic one in its on-color, a surface one in the icon color at rest), so a value set for the theme's fill never lands on the Accent's. |
| `--bit-Nav-selected-description-color` | --bit-Nav-description-color, then --bit-clr-fg-ter | Description color of the selected item, and of a collapsed branch that holds it. The Accent parameter wins over it. |
| `--bit-Nav-selected-hover-background` | --bit-Nav-selected-background with 8% of --bit-Nav-selected-color mixed in | Background of the selected item, and of a collapsed branch that holds it, while it is hovered (pointer devices only). The selection gives its feedback on its own fill rather than taking the hovered one every other item gets, so the item just picked - which the pointer is still on right after the click - never looks unselected. Where the browser has no color-mix it keeps the selected background. The Accent parameter wins over it: an explicit Accent mixes its own on-color into its own selected fill. |
| `--bit-Nav-selected-pressed-background` | --bit-Nav-selected-hover-background with 8% of --bit-Nav-selected-hover-color mixed in | Background of the selected item, and of a collapsed branch that holds it, while it is pressed - on a touch screen too, where it is the one feedback a tap gets. Where the browser has no color-mix it falls back on --bit-Nav-selected-hover-background. The Accent parameter wins over it. |
| `--bit-Nav-selected-hover-color` | --bit-Nav-selected-color, then --bit-clr-fg-pri | Text and chevron color of the selected item, and of a collapsed branch that holds it (its group header included), while it is hovered or pressed - the one to move with --bit-Nav-selected-hover-background when the selected color does not read on that fill. The Accent parameter wins over it. |
| `--bit-Nav-selected-hover-icon-color` | --bit-Nav-selected-icon-color, then --bit-Nav-icon-color, then --bit-clr-pri | Icon color of the selected item, and of a collapsed branch that holds it, while it is hovered or pressed. The Accent and Color parameters win over it. |
| `--bit-Nav-selected-hover-description-color` | --bit-Nav-selected-description-color, then --bit-Nav-description-color, then --bit-clr-fg-ter | Description color of the selected item, and of a collapsed branch that holds it, while it is hovered or pressed. The Accent parameter wins over it. |
| `--bit-Nav-indicator-color` | --bit-clr-pri | Color of the leading bar of the selected item. The Color parameter wins over it. |
| `--bit-Nav-indicator-width` | --bit-shp-brd-width-thick | Thickness of the leading bar of the selected item; 0 removes it. In forced colors (Windows contrast themes) the bar is the one mark of the selection left, so there it is never thinner than --bit-shp-brd-width-thick. |
| `--bit-Nav-item-radius` | --bit-shp-radius-control | Corner radius of an item. |
| `--bit-Nav-item-min-height` | spacing(6) (48px) | Smallest height of an item. The Size parameter wins over it. |
| `--bit-Nav-item-padding` | 4px (spacing(0.5)) | Padding of an item; the indentation of the levels is added to its start. |
| `--bit-Nav-item-gap` | 0 | Room between two items, at every level. |
| `--bit-Nav-font-size` | --bit-tpg-fs-sm | Text size of an item. The Size parameter wins over it. |
| `--bit-Nav-icon-size` | --bit-siz-icon-md | Icon size of an item and of a group header. The Size parameter wins over it. |
| `--bit-Nav-description-font-size` | --bit-tpg-fs-xs | Text size of the description of an item. The Size parameter wins over it. |
| `--bit-Nav-header-color` | --bit-clr-fg-pri | Text color of a group header (Grouped render type). |
| `--bit-Nav-header-font-size` | --bit-tpg-fs-lg | Text size of a group header. The Size parameter wins over it. |
| `--bit-Nav-header-min-height` | spacing(5.5) (44px) | Smallest height of a group header; one with a description grows past it. The Size parameter wins over it. |
| `--bit-Nav-header-border-color` | --bit-clr-brd-pri | Color of the rule under a group header. |
| `--bit-Nav-header-hover-background` | --bit-clr-bg-pri-hover | Background of a hovered group header (pointer devices only); a collapsed one that holds the selected item takes --bit-Nav-selected-hover-background instead. |
| `--bit-Nav-separator-color` | --bit-clr-brd-sec | Color of a separator item. |
| `--bit-Nav-badge-color` | --bit-clr-err-text | Text color of the badge of an item; it keeps it in every state of the item. |
| `--bit-Nav-badge-background` | --bit-clr-err | Fill of the badge and the dot of an item; it keeps it in every state of the item. |
| `--bit-Nav-badge-font-size` | --bit-tpg-fs-2xs | Text size of the badge of an item. The Size parameter wins over it. |
| `--bit-Nav-badge-height` | --bit-siz-badge-md | Height of the badge of an item, which is also its smallest width, so a one-digit count stays round. The Size parameter wins over it. |
| `--bit-Nav-badge-dot-size` | --bit-siz-badge-dot-md | Diameter of the dot of an item. The Size parameter wins over it. |
## Examples
Item
Custom
Option
\n**Basic**:
```razor
```
```csharp
private static readonly List basicNavItems =
[
new()
{
Text = "bit platform",
Description = "the bit platform description",
ChildItems =
[
new() { Text = "Home", IconName = BitIconName.Home, Url = "https://bitplatform.dev/" },
new()
{
Text = "Products & Services",
ChildItems =
[
new()
{
Text = "Project Templates",
ChildItems =
[
new() { Text = "Todo sample", IconName = BitIconName.ToDoLogoOutline, Url = "https://bitplatform.dev/templates/overview" },
new() { Text = "AdminPanel sample", IconName = BitIconName.LocalAdmin, Url = "https://bitplatform.dev/templates/overview" },
]
},
new() { Text = "BlazorUI", IconName = BitIconName.F12DevTools, Url = "https://bitplatform.dev/components" },
new() { Text = "Cloud hosting solutions", IconName = BitIconName.Cloud, Url = "https://bitplatform.dev/#", IsDisabled = true },
new() { Text = "Bit academy", IconName = BitIconName.LearningTools, Url = "https://bitplatform.dev/#", IsDisabled = true },
]
},
new() { Text = "Pricing", IconName = BitIconName.Money, Url = "https://bitplatform.dev/pricing" },
new() { Text = "About", IconName = BitIconName.Info, Url = "https://bitplatform.dev/about-us" },
new() { Text = "Contact us", IconName = BitIconName.Contact, Url = "https://bitplatform.dev/contact-us" },
],
},
new()
{
Text = "Community",
ChildItems =
[
new() { Text = "LinkedIn", IconName = BitIconName.LinkedInLogo, Url = "https://www.linkedin.com/company/bitplatformhq" },
new() { Text = "Twitter", IconName = BitIconName.Globe, Url = "https://twitter.com/bitplatformhq" },
new() { Text = "GitHub repo", IconName = BitIconName.GitGraph, Url = "https://github.com/bitfoundation/bitplatform" },
]
},
new() { Text = "Iconography", IconName = BitIconName.AppIconDefault, Url = "/iconography" },
];
```
\n**Grouped & Separator**:
```razor
```
```csharp
private static readonly List carNavItems =
[
new()
{
Text = "Mercedes-Benz",
ExpandAriaLabel = "Mercedes-Benz Expanded",
CollapseAriaLabel = "Mercedes-Benz Collapsed",
Title = "Mercedes-Benz Car Models",
IsExpanded = true,
Description = "Cars manufactured under the brand of Mercedes-Benz",
ChildItems =
[
new()
{
Text = "SUVs",
ChildItems =
[
new() { Text = "GLA", Url = "https://www.mbusa.com/en/vehicles/class/gla/suv", Target = "_blank" },
new() { Text = "GLB", Url = "https://www.mbusa.com/en/vehicles/class/glb/suv", Target = "_blank" },
new() { Text = "GLC", Url = "https://www.mbusa.com/en/vehicles/class/glc/suv", Target = "_blank" },
]
},
new()
{
Text = "Sedans & Wagons",
ChildItems =
[
new() { Text = "A Class", Url = "https://www.mbusa.com/en/vehicles/class/a-class/sedan", Target = "_blank" },
new() { Text = "C Class", Url = "https://www.mbusa.com/en/vehicles/class/c-class/sedan", Target = "_blank" },
new() { Text = "E Class", Url = "https://www.mbusa.com/en/vehicles/class/e-class/sedan", Target = "_blank" },
]
},
new()
{
Text = "Coupes",
ChildItems =
[
new() { Text = "CLA Coupe", Url = "https://www.mbusa.com/en/vehicles/class/cla/coupe", Target = "_blank" },
new() { Text = "C Class Coupe", Url = "https://www.mbusa.com/en/vehicles/class/c-class/coupe", Target = "_blank" },
new() { Text = "E Class Coupe", Url = "https://www.mbusa.com/en/vehicles/class/e-class/coupe", Target = "_blank" },
]
},
]
},
new()
{
Text = "Tesla",
ExpandAriaLabel = "Tesla Expanded",
CollapseAriaLabel = "Tesla Collapsed",
Title = "Tesla Car Models",
ChildItems =
[
new() { Text = "Model S", Url = "https://www.tesla.com/models", Target = "_blank" },
new() { Text = "Model X", Url = "https://www.tesla.com/modelx", Target = "_blank" },
new() { Text = "Model Y", Url = "https://www.tesla.com/modely", Target = "_blank" },
]
},
];
private static readonly List separatorNavItems =
[
new() { Text = "Home", IconName = BitIconName.Home, Url = "https://bitplatform.dev/" },
new() { Text = "Pricing", IconName = BitIconName.Money, Url = "https://bitplatform.dev/pricing" },
new() { IsSeparator = true },
new() { Text = "LinkedIn", IconName = BitIconName.LinkedInLogo, Url = "https://www.linkedin.com/company/bitplatformhq" },
new() { Text = "GitHub repo", IconName = BitIconName.GitGraph, Url = "https://github.com/bitfoundation/bitplatform" },
new() { IsSeparator = true },
new() { Text = "Contact us", IconName = BitIconName.Contact, Url = "https://bitplatform.dev/contact-us" },
];
```
\n**Manual Mode**:
```razor
```
```csharp
private static readonly List foodNavItems =
[
new()
{
Text = "Fast foods",
IconName = BitIconName.HeartBroken,
IsExpanded = true,
Description = "List of fast foods",
ChildItems =
[
new()
{
Text = "Burgers",
Description = "List of burgers",
ChildItems =
[
new() { Text = "Beef Burger" },
new() { Text = "Veggie Burger" },
new() { Text = "Bison Burger" },
new() { Text = "Wild Salmon Burger" },
]
},
new()
{
Text = "Pizza",
ChildItems =
[
new() { Text = "Cheese Pizza" },
new() { Text = "Veggie Pizza" },
new() { Text = "Pepperoni Pizza" },
new() { Text = "Meat Pizza" },
]
},
new() { Text = "French Fries" },
]
},
new()
{
Text = "Fruits",
IconName = BitIconName.Health,
ChildItems =
[
new() { Text = "Apple" },
new() { Text = "Orange" },
new() { Text = "Banana" },
]
},
new() { Text = "Ice Cream" },
new() { Text = "Cookie" },
];
private static List Flatten(IList e) => e.SelectMany(c => Flatten(c.ChildItems)).Concat(e).ToList();
private BitNavItem SelectedItemNav = foodNavItems[0].ChildItems[2];
private string? SelectedItemText = foodNavItems[0].ChildItems[2].Text;
private static readonly List> FoodMenuDropdownItems =
[
new() { Text = "Beef Burger", Value = "Beef Burger" },
new() { Text = "Veggie Burger", Value = "Veggie Burger" },
new() { Text = "Bison Burger", Value = "Bison Burger" },
new() { Text = "Wild Salmon Burger", Value = "Wild Salmon Burger" },
new() { Text = "Cheese Pizza", Value = "Cheese Pizza" },
new() { Text = "Veggie Pizza", Value = "Veggie Pizza" },
new() { Text = "Pepperoni Pizza", Value = "Pepperoni Pizza" },
new() { Text = "Meat Pizza", Value = "Meat Pizza" },
new() { Text = "French Fries", Value = "French Fries" },
new() { Text = "Apple", Value = "Apple" },
new() { Text = "Orange", Value = "Orange" },
new() { Text = "Banana", Value = "Banana" },
new() { Text = "Ice Cream", Value = "Ice Cream" },
new() { Text = "Cookie", Value = "Cookie" },
];
```
\n**Expand & Collapse**:
```razor
```
```csharp
private static readonly List singleExpandNavItems =
[
new()
{
Text = "Fast foods",
IconName = BitIconName.HeartBroken,
ChildItems =
[
new() { Text = "Burgers", ChildItems = [new() { Text = "Beef Burger" }, new() { Text = "Veggie Burger" }] },
new() { Text = "Pizza", ChildItems = [new() { Text = "Cheese Pizza" }, new() { Text = "Meat Pizza" }] },
new() { Text = "French Fries" },
]
},
new()
{
Text = "Fruits",
IconName = BitIconName.Health,
ChildItems = [new() { Text = "Apple" }, new() { Text = "Orange" }, new() { Text = "Banana" }]
},
new()
{
Text = "Drinks",
IconName = BitIconName.Coffee,
ChildItems = [new() { Text = "Water" }, new() { Text = "Tea" }]
},
];
private static readonly List noCollapseNavItems =
[
new()
{
Text = "bit platform",
Description = "the bit platform description",
ChildItems =
[
new() { Text = "Home", IconName = BitIconName.Home, Url = "https://bitplatform.dev/" },
new()
{
Text = "Products & Services",
ChildItems =
[
new()
{
Text = "Project Templates",
ChildItems =
[
new() { Text = "Todo sample", IconName = BitIconName.ToDoLogoOutline, Url = "https://bitplatform.dev/templates/overview" },
new() { Text = "AdminPanel sample", IconName = BitIconName.LocalAdmin, Url = "https://bitplatform.dev/templates/overview" },
]
},
new() { Text = "BlazorUI", IconName = BitIconName.F12DevTools, Url = "https://bitplatform.dev/components" },
new() { Text = "Cloud hosting solutions", IconName = BitIconName.Cloud, Url = "https://bitplatform.dev/#", IsDisabled = true },
new() { Text = "Bit academy", IconName = BitIconName.LearningTools, Url = "https://bitplatform.dev/#", IsDisabled = true },
]
},
new() { Text = "Pricing", IconName = BitIconName.Money, Url = "https://bitplatform.dev/pricing" },
new() { Text = "About", IconName = BitIconName.Info, Url = "https://bitplatform.dev/about-us" },
new() { Text = "Contact us", IconName = BitIconName.Contact, Url = "https://bitplatform.dev/contact-us" },
],
},
new()
{
Text = "Community",
ChildItems =
[
new() { Text = "LinkedIn", IconName = BitIconName.LinkedInLogo , Url = "https://www.linkedin.com/company/bitplatformhq" },
new() { Text = "Twitter", IconName = BitIconName.Globe , Url = "https://twitter.com/bitplatformhq" },
new() { Text = "GitHub repo", IconName = BitIconName.GitGraph , Url = "https://github.com/bitfoundation/bitplatform" },
]
},
new() { Text = "Iconography", IconName = BitIconName.AppIconDefault, Url = "/iconography" },
];
```
\n**Custom Templates**:
```razor
```
```csharp
// The Data of an item is whatever the app needs; the template above reads a count off it.
private static readonly List mailNavItems =
[
new() { Text = "Inbox", IconName = BitIconName.Inbox, Data = 12 },
new() { Text = "Drafts", IconName = BitIconName.EditMail, Data = 2 },
new() { Text = "Sent", IconName = BitIconName.Send },
new() { Text = "Archive", IconName = BitIconName.Archive },
];
private static readonly List colorNavItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Products", IconName = BitIconName.Product },
new() { Text = "Settings", IconName = BitIconName.Settings },
];
private static readonly List carNavItems =
[
new()
{
Text = "Mercedes-Benz",
ExpandAriaLabel = "Mercedes-Benz Expanded",
CollapseAriaLabel = "Mercedes-Benz Collapsed",
Title = "Mercedes-Benz Car Models",
IsExpanded = true,
Description = "Cars manufactured under the brand of Mercedes-Benz",
ChildItems =
[
new()
{
Text = "SUVs",
ChildItems =
[
new() { Text = "GLA", Url = "https://www.mbusa.com/en/vehicles/class/gla/suv", Target = "_blank" },
new() { Text = "GLB", Url = "https://www.mbusa.com/en/vehicles/class/glb/suv", Target = "_blank" },
new() { Text = "GLC", Url = "https://www.mbusa.com/en/vehicles/class/glc/suv", Target = "_blank" },
]
},
new()
{
Text = "Sedans & Wagons",
ChildItems =
[
new() { Text = "A Class", Url = "https://www.mbusa.com/en/vehicles/class/a-class/sedan", Target = "_blank" },
new() { Text = "C Class", Url = "https://www.mbusa.com/en/vehicles/class/c-class/sedan", Target = "_blank" },
new() { Text = "E Class", Url = "https://www.mbusa.com/en/vehicles/class/e-class/sedan", Target = "_blank" },
]
},
new()
{
Text = "Coupes",
ChildItems =
[
new() { Text = "CLA Coupe", Url = "https://www.mbusa.com/en/vehicles/class/cla/coupe", Target = "_blank" },
new() { Text = "C Class Coupe", Url = "https://www.mbusa.com/en/vehicles/class/c-class/coupe", Target = "_blank" },
new() { Text = "E Class Coupe", Url = "https://www.mbusa.com/en/vehicles/class/e-class/coupe", Target = "_blank" },
]
},
]
},
new()
{
Text = "Tesla",
ExpandAriaLabel = "Tesla Expanded",
CollapseAriaLabel= "Tesla Collapsed",
Title = "Tesla Car Models",
ChildItems =
[
new() { Text = "Model S", Url = "https://www.tesla.com/models", Target = "_blank" },
new() { Text = "Model X", Url = "https://www.tesla.com/modelx", Target = "_blank" },
new() { Text = "Model Y", Url = "https://www.tesla.com/modely", Target = "_blank" },
]
},
];
```
\n**Events**:
```razor
foodNavItems =
[
new()
{
Text = "Fast foods",
IconName = BitIconName.HeartBroken,
IsExpanded = true,
Description = "List of fast foods",
ChildItems =
[
new()
{
Text = "Burgers",
Description = "List of burgers",
ChildItems =
[
new() { Text = "Beef Burger" },
new() { Text = "Veggie Burger" },
new() { Text = "Bison Burger" },
new() { Text = "Wild Salmon Burger" },
]
},
new()
{
Text = "Pizza",
ChildItems =
[
new() { Text = "Cheese Pizza" },
new() { Text = "Veggie Pizza" },
new() { Text = "Pepperoni Pizza" },
new() { Text = "Meat Pizza" },
]
},
new() { Text = "French Fries" },
]
},
new()
{
Text = "Fruits",
IconName = BitIconName.Health,
ChildItems =
[
new() { Text = "Apple" },
new() { Text = "Orange" },
new() { Text = "Banana" },
]
},
new() { Text = "Ice Cream" },
new() { Text = "Cookie" },
];
```
\n**Accessibility**:
```razor
```
```csharp
private static readonly List a11yNavItems =
[
new()
{
Text = "Navs",
IconName = BitIconName.GlobalNavButton,
Url = "/components",
Description = "Links to the areas of an app",
ExpandAriaLabel = "Show the navs",
CollapseAriaLabel = "Hide the navs",
ChildItems =
[
new() { Text = "Nav", Url = "/components/nav" },
new() { Text = "NavBar", Url = "/components/navbar" },
new() { Text = "Breadcrumb", Url = "/components/breadcrumb" },
]
},
new()
{
Text = "Inputs",
IconName = BitIconName.TextField,
Description = "Fields that take a value",
ChildItems =
[
new() { Text = "TextField", Url = "/components/textfield" },
new() { Text = "Dropdown", Url = "/components/dropdown" },
]
},
];
```
\n**Cascading parameters**:
```razor
```
```csharp
private readonly BitNavParams[] navParams =
[
new() { Mode = BitNavMode.Manual, FitWidth = true, IconOnly = true }
];
private static readonly List colorNavItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Products", IconName = BitIconName.Product },
new() { Text = "Settings", IconName = BitIconName.Settings },
];
```
\n**Badges & Suffix**:
```razor
```
```csharp
private static readonly List badgeNavItems =
[
new() { Text = "Inbox", IconName = BitIconName.Inbox, Badge = "12", BadgeAriaLabel = "12 unread" },
new() { Text = "Drafts", IconName = BitIconName.EditMail, Badge = "New" },
new() { Text = "Sent", IconName = BitIconName.Send, Dot = true, BadgeAriaLabel = "failed to send" },
new() { Text = "Archive", IconName = BitIconName.Archive },
];
private static readonly List suffixNavItems =
[
new() { Text = "Inbox", IconName = BitIconName.Inbox, Badge = "12", Data = "Ctrl+I" },
new() { Text = "Drafts", IconName = BitIconName.EditMail, Data = "Ctrl+D" },
new() { Text = "Sent", IconName = BitIconName.Send, Data = "Ctrl+S" },
];
```
\n**External Icons**:
```razor
```
```csharp
private static readonly List externalIconNavItems =
[
new()
{
Text = "bit platform",
Description = "Nav with external icons (FontAwesome)",
ChildItems =
[
new() { Text = "Home", Icon = BitIconInfo.Css("fa-solid fa-house"), Url = "https://bitplatform.dev/" },
new()
{
Text = "Products & Services",
ChildItems =
[
new() { Text = "BlazorUI", Icon = BitIconInfo.Fa("solid code"), Url = "https://bitplatform.dev/components" },
new() { Text = "Pricing", Icon = BitIconInfo.Css("fa-solid fa-tag"), Url = "https://bitplatform.dev/pricing" },
]
},
new() { Text = "About", Icon = BitIconInfo.Fa("solid circle-info"), Url = "https://bitplatform.dev/about-us" },
new() { Text = "Contact us", Icon = BitIconInfo.Css("fa-solid fa-envelope"), Url = "https://bitplatform.dev/contact-us" },
],
},
new() { Text = "Iconography", Icon = BitIconInfo.Css("fa-solid fa-icons"), Url = "/iconography" },
];
private static readonly BitIconInfo bootstrapChevronIcon = BitIconInfo.Bi("chevron-right");
private static readonly List bootstrapIconNavItems =
[
new()
{
Text = "bit platform",
Description = "Nav with external icons (Bootstrap Icons)",
ChildItems =
[
new() { Text = "Home", Icon = BitIconInfo.Bi("house-fill"), Url = "https://bitplatform.dev/" },
new() { Text = "BlazorUI", Icon = BitIconInfo.Bi("code-slash"), Url = "https://bitplatform.dev/components" },
new() { Text = "Pricing", Icon = BitIconInfo.Bi("tag-fill"), Url = "https://bitplatform.dev/pricing" },
],
},
new() { Text = "Iconography", Icon = BitIconInfo.Bi("emoji-smile"), Url = "/iconography" },
];
```
\n**Style & Class**:
```razor
```
```csharp
private static readonly List styleClassNavItems =
[
new() { Text = "Home", IconName = BitIconName.Home, Style = "background: rgba(255,99,71,0.2);" },
new() { Text = "Products", IconName = BitIconName.Product, Class = "custom-item-list" },
new() { Text = "Settings", IconName = BitIconName.Settings },
];
private static readonly List customStyleNavItems =
[
new()
{
Text = "bit platform",
Description = "the bit platform description",
ChildItems =
[
new() { Text = "Home", IconName = BitIconName.Home, Url = "https://bitplatform.dev/" },
new() { Text = "BlazorUI", IconName = BitIconName.F12DevTools, Url = "https://bitplatform.dev/components" },
],
},
new() { Text = "Iconography", IconName = BitIconName.AppIconDefault, Url = "/iconography" },
new() { IsSeparator = true },
new() { Text = "Contact us", IconName = BitIconName.Contact, Url = "https://bitplatform.dev/contact-us" },
];
private static readonly List customClassNavItems =
[
new()
{
Text = "bit platform",
IconName = BitIconName.Website,
Description = "the bit platform description",
ChildItems =
[
new() { Text = "Home", IconName = BitIconName.Home, Url = "https://bitplatform.dev/" },
new() { Text = "BlazorUI", IconName = BitIconName.F12DevTools, Url = "https://bitplatform.dev/components" },
],
},
new()
{
Text = "Community",
IconName = BitIconName.Group,
ChildItems = [new() { Text = "GitHub repo", IconName = BitIconName.GitGraph, Url = "https://github.com/bitfoundation/bitplatform" }]
},
];
private static readonly List colorNavItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Products", IconName = BitIconName.Product },
new() { Text = "Settings", IconName = BitIconName.Settings },
];
```
\n**RTL**:
```razor
```
```csharp
private static readonly List rtlNavItems =
[
new()
{
Text = "پلتفرمِ بیت",
Description = "توضیحاتِ پلتفرمِ بیت",
ChildItems =
[
new() { Text = "خانه", IconName = BitIconName.Home, Url = "https://bitplatform.dev/" },
new()
{
Text = "محصولات و خدمات",
ChildItems =
[
new()
{
Text = "قالب های پروژه",
ChildItems =
[
new() { Text = "نمونه ی Todo", IconName = BitIconName.ToDoLogoOutline, Url = "https://bitplatform.dev/templates/overview" },
new() { Text = "نمونه ی AdminPanel", IconName = BitIconName.LocalAdmin, Url = "https://bitplatform.dev/templates/overview" },
]
},
new() { Text = "رابط کاربری Blazor", IconName = BitIconName.F12DevTools, Url = "https://blazorui-ai.bitplatform.dev/" },
new() { Text = "راه های هاست ابری", IconName = BitIconName.Cloud, Url = "https://bitplatform.dev/#", IsDisabled = true },
new() { Text = "آکادمی بیت", IconName = BitIconName.LearningTools, Url = "https://bitplatform.dev/#", IsDisabled = true },
]
},
new() { Text = "قیمت", IconName = BitIconName.Money, Url = "https://bitplatform.dev/pricing" },
new() { Text = "درباره ما", IconName = BitIconName.Info, Url = "https://bitplatform.dev/about-us" },
new() { Text = "ارتباط با ما", IconName = BitIconName.Contact, Url = "https://bitplatform.dev/contact-us" },
],
},
new()
{
Text = "انجمن ها",
ChildItems =
[
new() { Text = "لینکدین", IconName = BitIconName.LinkedInLogo, Url = "https://www.linkedin.com/company/bitplatformhq" },
new() { Text = "توییتر", IconName = BitIconName.Globe, Url = "https://twitter.com/bitplatformhq" },
new() { Text = "گیتهاب", IconName = BitIconName.GitGraph, Url = "https://github.com/bitfoundation/bitplatform" },
]
},
new() { Text = "شمایل نگاری", IconName = BitIconName.AppIconDefault, Url = "/iconography" },
];
```
Clicked Item: @ClickedItem?.Text
Selected Item: @SelectedItem?.Text
Toggled Item: @(ToggledItem is null ? "N/A" : $"{ToggledItem.Text} ({(ToggledItem.IsExpanded ? "Expanded" : "Collapsed")})")
```
```csharp
private BitNavItem ClickedItem = default!;
private BitNavItem SelectedItem = default!;
private BitNavItem ToggledItem = default!;
private static readonly ListSelected Item: @SelectedItem?.Text
Toggled Item: @(ToggledItem is null ? "N/A" : $"{ToggledItem.Text} ({(ToggledItem.IsExpanded ? "Expanded" : "Collapsed")})")