# NavBar
**Also known as:** NavMenu, TabPanel, BottomNavigation, TabBar, NavigationRail
## Description
A bar of navigation links to the main areas of an app, the way a mobile app puts its top-level destinations along the bottom of the screen.
## Parameters
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| Alignment | `BitAlignment?` | null | How the items are distributed along the navbar: packed at its start, its center or its end, or spread over it. While it is not set, the items of a horizontal navbar are spread evenly over its width and the items of a vertical rail are packed at its top. Baseline and Stretch carry no distribution of their own and are left at the default; use Justified to have the items fill the navbar. |
| AutoReorderOptions | `bool` | false | Keeps the order of the registered options in sync with the markup order of the options, even when an option is added, removed or reordered conditionally after the first render (an option that shows up later registers itself at the end of the list, which leaves the keyboard moving between the items in another order than the one they are rendered in). This is achieved by reading the DOM order of the options after each render, so it adds a JS interop call per change and is opt-in. |
| ChildContent | `RenderFragment?` | null | Items to render as children. |
| Classes | `BitNavBarClassStyles?` | null | Custom CSS classes for different parts of the navbar. |
| Color | `BitColor?` | null | The general color of the navbar, used for the icon, the text and the indicator of the selected item. |
| DefaultSelectedItem | `TItem?` | null | The initially selected item in manual mode. |
| Filled | `bool` | false | Fills the hovered and the selected item of the navbar with the Color of the navbar. While it is not enabled, the selection is conveyed by the color of the item alone. |
| FitWidth | `bool` | false | Renders the nav bar in a width to only fit its content. |
| FooterTemplate | `RenderFragment?` | null | The content rendered after the items of the navbar, outside of the list they form: the trailing actions of a bar, or the account button at the bottom of a navigation rail. |
| FullWidth | `bool` | false | Renders the nav bar in full width of its container element. |
| HeaderTemplate | `RenderFragment?` | null | The content rendered before the items of the navbar, outside of the list they form: the logo or the menu button of a bar, or the button a navigation rail is conventionally headed with. |
| HideUnselectedText | `bool` | false | Only renders the text of the selected item and leaves the rest of the items with their icon alone, which is how a navigation bar keeps its labels readable while holding more destinations. Ignored while IconOnly is enabled. |
| IconOnly | `bool` | false | Only renders the icon of each navbar item. |
| Indicator | `BitNavBarIndicator?` | null | The shape of the indicator that marks the selected item: a line along the edge of the item, or the pill a Material navigation bar draws behind the icon of its current destination. While it is not set, the selection is conveyed by the color of the item and by the fill Filled gives it. |
| InlineText | `bool` | false | Renders the icon and the text of each item side by side instead of stacking the text under the icon. |
| Items | `IList<TItem>` | new List<TItem>() | A collection of items to display in the navbar. |
| ItemTemplate | `RenderFragment<TItem>?` | null | Used to customize how content inside the item is rendered. |
| ItemTemplateRenderMode | `BitNavItemTemplateRenderMode` | BitNavItemTemplateRenderMode.Normal | Whether the ItemTemplate is rendered inside the anchor (or the button) each item is, or replaces it altogether, which is what items that are controls of their own need, since an interactive element cannot be nested in another one. Replaced items are left out of the keyboard navigation of the navbar, and whatever they render owns its own clicks, its own focus and its own accessible name. |
| Justified | `bool` | false | Gives every item an equal share of the navbar so that the items evenly fill it, which is how a navigation bar keeps its destinations on a predictable grid. By default each item only takes the width of its own content. |
| Match | `BitNavMatch?` | null | Modifies how the URL of an item is matched against the current URL in the automatic mode. The Match of an item takes precedence over this value, and the default is an exact match. |
| Mode | `BitNavMode` | BitNavMode.Automatic | Determines how the navigation will be handled. |
| NameSelectors | `BitNavBarNameSelectors<TItem>?` | null | Names and selectors of the custom input type properties. |
| OnItemClick | `EventCallback<TItem>` | | Callback invoked when an item is clicked. |
| OnSelectItem | `EventCallback<TItem>` | | Callback invoked when an item is selected. |
| Options | `RenderFragment?` | null | Alias of ChildContent. |
| Reselectable | `bool` | false | Enables recalling the select events when the same item is selected. |
| SafeArea | `bool` | false | Reserves the safe area of the device (the home indicator of a phone, for instance) under the navbar, so a bar pinned to the bottom of the screen is not overlapped by it. |
| Scrollable | `bool` | false | Lets the items scroll along the navbar instead of being squeezed into it, which is what a bar (or a rail) holding more destinations than it has room for needs. The scrollbar itself is hidden, the items keep the size of their own content, and the selected one is scrolled into view as the selection moves. |
| SelectedItem | `TItem?` | null | Selected item to show in the navbar. Supports two-way binding. |
| SelectOnFocus | `bool` | false | Selects an item as soon as the focus reaches it, so walking the navbar with the arrow keys switches the selection along with it, the way the tabs of a tab list do. It only applies to the Manual mode, where the selection is the navbar's own. |
| SingleTabStop | `bool` | false | Takes the navbar out of the tab sequence as a single stop: only the selected item (or the first one, while nothing is selected) is tabbable and the arrow keys move between the items, exactly like a toolbar. By default every item is a tab stop of its own, the way the links of a navigation are. |
| Size | `BitSize?` | null | The size of the navbar. |
| Styles | `BitNavBarClassStyles?` | null | Custom CSS styles for different parts of the navbar. |
| Vertical | `bool` | false | Stacks the items of the navbar in a column, which turns it into a vertical navigation rail. |
| WrapNavigation | `bool` | false | Lets the arrow keys wrap around at both ends of the navbar, from the last item to the first one and back, the way the toolbar pattern does. By default the focus stops at the ends instead. |
| 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. |
| 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. |
| Id | `string?` | null | Gets or sets the unique identifier for the component's root element. |
| IsEnabled | `bool` | true | Gets or sets a value indicating whether the component is enabled and can respond to user interaction. |
| 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 |
| :--- | :--- | :------------ | :---------- |
| FocusItem | `Func<TItem, ValueTask>` | | Moves the focus to an item of the navbar. |
| ScrollItemIntoView | `Func<TItem, ValueTask>` | | Brings an item into the visible area of a Scrollable navbar, without selecting it or moving the focus onto it. It is a no-op on a navbar that does not scroll. |
| SelectItem | `Func<TItem?, Task>` | | Selects an item programmatically, exactly like a click on that item would in the manual mode. |
| 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
### BitNavMode Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Automatic | 0 | The navbar 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 navbar that switches between the panels of a single page needs. |
### 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. |
### 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. |
### 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 of the navbar. |
| 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 of the navbar. |
### BitNavBarIndicator Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| None | 0 | No indicator of its own: the selection is conveyed by the color of the item and, while Filled is enabled, by the fill of the item. |
| Line | 1 | A line drawn along the edge of the selected item: its bottom edge in a horizontal navbar and its leading edge in a vertical rail, the way a tab strip marks its current tab. |
| Pill | 2 | A pill drawn behind the icon of the selected item, which is how a Material navigation bar marks its current destination. It takes the fill off the item itself, so the pill is the only filled part. |
### BitAlignment Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Start | 0 | Packs the items at the start of the navbar. |
| End | 1 | Packs the items at the end of the navbar. |
| Center | 2 | Packs the items in the center of the navbar. |
| SpaceBetween | 3 | Spreads the items over the navbar, leaving no space before the first one and after the last one. |
| SpaceAround | 4 | Spreads the items over the navbar with equal space around each of them, which is what a horizontal navbar does on its own. |
| SpaceEvenly | 5 | Spreads the items over the navbar with equal space between them and at both of its ends. |
| Baseline | 6 | Carries no distribution of its own here, so the navbar keeps its default. |
| Stretch | 7 | Carries no distribution of its own here, so the navbar keeps its default. Use Justified to have the items fill the navbar. |
### 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
### BitNavBarItem Properties
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| AdditionalUrls | `IEnumerable<string>?` | null | Alternative URLs to be considered when auto mode tries to detect the selected navbar item by the current URL. |
| AriaCurrent | `BitNavAriaCurrent` | BitNavAriaCurrent.Page | The value of the aria-current attribute of the navbar item when it is the selected one. |
| AriaLabel | `string?` | null | The accessible label of the navbar item, announced instead of its content. When it is not provided and the text of the item is not rendered (in the IconOnly or the HideUnselectedText modes), the text of the item is used, so an icon is never left unnamed. |
| Badge | `string?` | null | The badge text to render on the icon of the navbar item, for a count or a short status. Takes precedence over Dot when both are set. |
| BadgeAriaLabel | `string?` | null | The accessible description of the badge (or the dot) of the navbar item, folded into the accessible name of the item so a count that only exists as a colored bubble is not lost on a screen reader. 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 navbar item. |
| Data | `object?` | null | The custom data for the navbar item to provide additional state. |
| Dot | `bool` | false | Renders a small dot on the icon of the navbar item, to mark it as needing attention without showing a number. Ignored while Badge is set. |
| Icon | `BitIconInfo?` | null | Gets or sets the icon to display using custom CSS classes for external icon libraries. Takes precedence over IconName when both are set. |
| IconName | `string?` | null | Gets or sets the name of the icon to display from the built-in Fluent UI icons. |
| IsEnabled | `bool` | true | Whether or not the navbar item is enabled. |
| Key | `string?` | null | A unique value to use as a key or id of the navbar item. |
| Match | `BitNavMatch?` | null | Modifies how the URL of the navbar item is matched against the current URL in the automatic mode. Takes precedence over the Match of the navbar itself. |
| SelectedIcon | `BitIconInfo?` | null | The icon to display while the navbar item is the selected one, using custom CSS classes for external icon libraries. Takes precedence over SelectedIconName when both are set, and falls back to Icon / IconName while neither is set. |
| SelectedIconName | `string?` | null | The name of the icon to display from the built-in Fluent UI icons while the navbar item is the selected one, which is how a navigation bar marks its current destination with the filled variant of the same glyph. |
| Style | `string?` | null | Custom CSS style for the navbar item. |
| Target | `string?` | null | Link target, specifies how to open the navbar item's link. |
| Template | `RenderFragment<BitNavBarItem>?` | null | The custom template for the navbar item to render. |
| TemplateRenderMode | `BitNavItemTemplateRenderMode` | BitNavItemTemplateRenderMode.Normal | Whether the Template of the navbar item is rendered inside the anchor (or the button) the item is, or replaces it altogether, which is what an item that is a control of its own needs, since an interactive element cannot be nested in another one. A replaced item is left out of the keyboard navigation of the navbar. |
| Text | `string?` | null | Text to render for the navbar item. |
| Title | `string?` | null | Text for the tooltip of the navbar item. |
| Url | `string?` | null | The navbar item's link URL. |
### BitNavBarOption Properties
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| AdditionalUrls | `IEnumerable<string>?` | null | Alternative URLs to be considered when auto mode tries to detect the selected navbar option by the current URL. |
| AriaCurrent | `BitNavAriaCurrent` | BitNavAriaCurrent.Page | The value of the aria-current attribute of the navbar option when it is the selected one. |
| AriaLabel | `string?` | null | The accessible label of the navbar option, announced instead of its content. When it is not provided and the text of the option is not rendered (in the IconOnly or the HideUnselectedText modes), the text of the option is used, so an icon is never left unnamed. |
| Badge | `string?` | null | The badge text to render on the icon of the navbar option, for a count or a short status. Takes precedence over Dot when both are set. |
| BadgeAriaLabel | `string?` | null | The accessible description of the badge (or the dot) of the navbar option, folded into the accessible name of the option so a count that only exists as a colored bubble is not lost on a screen reader. 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 navbar option. |
| Data | `object?` | null | The custom data for the navbar option to provide additional state. |
| Dot | `bool` | false | Renders a small dot on the icon of the navbar option, to mark it as needing attention without showing a number. Ignored while Badge is set. |
| Icon | `BitIconInfo?` | null | Gets or sets the icon to display using custom CSS classes for external icon libraries. Takes precedence over IconName when both are set. |
| IconName | `string?` | null | Gets or sets the name of the icon to display from the built-in Fluent UI icons. |
| IsEnabled | `bool` | true | Whether or not the navbar option is enabled. |
| Key | `string?` | null | A unique value to use as a key or id of the navbar option. |
| Match | `BitNavMatch?` | null | Modifies how the URL of the navbar option is matched against the current URL in the automatic mode. Takes precedence over the Match of the navbar itself. |
| SelectedIcon | `BitIconInfo?` | null | The icon to display while the navbar option is the selected one, using custom CSS classes for external icon libraries. Takes precedence over SelectedIconName when both are set, and falls back to Icon / IconName while neither is set. |
| SelectedIconName | `string?` | null | The name of the icon to display from the built-in Fluent UI icons while the navbar option is the selected one, which is how a navigation bar marks its current destination with the filled variant of the same glyph. |
| Style | `string?` | null | Custom CSS style for the navbar option. |
| Target | `string?` | null | Link target, specifies how to open the navbar option's link. |
| Template | `RenderFragment<BitNavBarOption>?` | null | The custom template for the navbar option to render. |
| TemplateRenderMode | `BitNavItemTemplateRenderMode` | BitNavItemTemplateRenderMode.Normal | Whether the Template of the navbar option is rendered inside the anchor (or the button) the option is, or replaces it altogether, which is what an option that is a control of its own needs, since an interactive element cannot be nested in another one. A replaced option is left out of the keyboard navigation of the navbar. |
| Text | `string?` | null | Text to render for the navbar option. |
| Title | `string?` | null | Text for the tooltip of the navbar option. |
| Url | `string?` | null | The navbar option's link URL. |
### BitNavBarNameSelectors<TItem> Properties
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| AdditionalUrls | `BitNameSelectorPair<TItem, IEnumerable<string>?>` | new(nameof(BitNavBarItem.AdditionalUrls)) | The AdditionalUrls field name and selector of the custom input class. |
| AriaCurrent | `BitNameSelectorPair<TItem, BitNavAriaCurrent?>` | new(nameof(BitNavBarItem.AriaCurrent)) | The AriaCurrent field name and selector of the custom input class. |
| AriaLabel | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavBarItem.AriaLabel)) | The AriaLabel field name and selector of the custom input class. |
| Badge | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavBarItem.Badge)) | The Badge field name and selector of the custom input class. |
| BadgeAriaLabel | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavBarItem.BadgeAriaLabel)) | The BadgeAriaLabel field name and selector of the custom input class. |
| Class | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavBarItem.Class)) | The Class field name and selector of the custom input class. |
| Data | `BitNameSelectorPair<TItem, object?>` | new(nameof(BitNavBarItem.Data)) | The Data field name and selector of the custom input class. |
| Dot | `BitNameSelectorPair<TItem, bool?>` | new(nameof(BitNavBarItem.Dot)) | The Dot field name and selector of the custom input class. |
| Icon | `BitNameSelectorPair<TItem, BitIconInfo?>` | new(nameof(BitNavBarItem.Icon)) | The Icon field name and selector of the custom input class. Maps to Icon for external icon libraries. |
| IconName | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavBarItem.IconName)) | The IconName field name and selector of the custom input class. Maps to IconName for built-in Fluent UI icons. |
| IsEnabled | `BitNameSelectorPair<TItem, bool?>` | new(nameof(BitNavBarItem.IsEnabled)) | The IsEnabled field name and selector of the custom input class. |
| Key | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavBarItem.Key)) | The Key field name and selector of the custom input class. |
| Match | `BitNameSelectorPair<TItem, BitNavMatch?>` | new(nameof(BitNavBarItem.Match)) | The Match field name and selector of the custom input class. |
| SelectedIcon | `BitNameSelectorPair<TItem, BitIconInfo?>` | new(nameof(BitNavBarItem.SelectedIcon)) | The SelectedIcon field name and selector of the custom input class. Maps to SelectedIcon for external icon libraries. |
| SelectedIconName | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavBarItem.SelectedIconName)) | The SelectedIconName field name and selector of the custom input class. Maps to SelectedIconName for built-in Fluent UI icons. |
| Style | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavBarItem.Style)) | The Style field name and selector of the custom input class. |
| Target | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavBarItem.Target)) | The Target field name and selector of the custom input class. |
| Template | `BitNameSelectorPair<TItem, RenderFragment<TItem>?>` | new(nameof(BitNavBarItem.Template)) | The Template field name and selector of the custom input class. |
| TemplateRenderMode | `BitNameSelectorPair<TItem, BitNavItemTemplateRenderMode?>` | new(nameof(BitNavBarItem.TemplateRenderMode)) | The TemplateRenderMode field name and selector of the custom input class. |
| Text | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavBarItem.Text)) | The Text field name and selector of the custom input class. |
| Title | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavBarItem.Title)) | The Title field name and selector of the custom input class. |
| Url | `BitNameSelectorPair<TItem, string?>` | new(nameof(BitNavBarItem.Url)) | The Url field name and selector of the custom input class. |
### 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. |
### BitNavBarClassStyles Properties
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| Root | `string?` | null | Custom CSS classes/styles for the root element of the BitNavBar. |
| Container | `string?` | null | Custom CSS classes/styles for the container of the items of the BitNavBar. |
| Footer | `string?` | null | Custom CSS classes/styles for the footer of the BitNavBar, rendered after the items. |
| Header | `string?` | null | Custom CSS classes/styles for the header of the BitNavBar, rendered before the items. |
| Item | `string?` | null | Custom CSS classes/styles for the item of the BitNavBar. |
| ItemBadge | `string?` | null | Custom CSS classes/styles for the badge (or the dot) of the item of the BitNavBar. |
| ItemIcon | `string?` | null | Custom CSS classes/styles for the item icon of the BitNavBar. |
| ItemIconContainer | `string?` | null | Custom CSS classes/styles for the wrapper of the icon and the badge of the item of the BitNavBar. |
| ItemText | `string?` | null | Custom CSS classes/styles for the item text of the BitNavBar. |
| ItemWrapper | `string?` | null | Custom CSS classes/styles for the list item wrapping each item of the BitNavBar. |
| SelectedItem | `string?` | null | Custom CSS classes/styles for the selected item of the BitNavBar. |
## Examples
Item
Custom
Option
\n**Basic**:
```razor
```
```csharp
private static readonly List basicNavBarItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Products", IconName = BitIconName.ProductVariant },
new() { Text = "Academy", IconName = BitIconName.LearningTools },
new() { Text = "Profile", IconName = BitIconName.Contact },
];
```
\n**Scrollable**:
```razor
Select the last item
Selected item: @scrollableSelectedItem?.Text
```
```csharp
private static readonly List scrollableNavBarItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Products", IconName = BitIconName.ProductVariant },
new() { Text = "Academy", IconName = BitIconName.LearningTools },
new() { Text = "Inbox", IconName = BitIconName.Mail },
new() { Text = "Alerts", IconName = BitIconName.Ringer },
new() { Text = "Favorites", IconName = BitIconName.Heart },
new() { Text = "Reports", IconName = BitIconName.ReportDocument },
new() { Text = "Settings", IconName = BitIconName.Settings },
new() { Text = "Support", IconName = BitIconName.Help },
new() { Text = "Profile", IconName = BitIconName.Contact },
];
private BitNavBarItem? scrollableSelectedItem;
```
\n**Header & Footer**:
```razor
```
```csharp
private static readonly List basicNavBarItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Products", IconName = BitIconName.ProductVariant },
new() { Text = "Academy", IconName = BitIconName.LearningTools },
new() { Text = "Profile", IconName = BitIconName.Contact },
];
```
\n**Templates**:
```razor
@item.Text
```
```csharp
private static readonly List basicNavBarItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Products", IconName = BitIconName.ProductVariant },
new() { Text = "Academy", IconName = BitIconName.LearningTools },
new() { Text = "Profile", IconName = BitIconName.Contact },
];
private static readonly List templateNavBarItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Products", Template = (item) => @ replacedTemplateNavBarItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Search", IconName = BitIconName.Search },
new()
{
Text = "New",
TemplateRenderMode = BitNavItemTemplateRenderMode.Replace,
Template = (item) => @
},
new() { Text = "Alerts", IconName = BitIconName.Ringer },
new() { Text = "Profile", IconName = BitIconName.Contact },
];
```
\n**Events**:
```razor
Clicked item: @eventsClickedItem?.Text
Selected item: @eventsSelectedItem?.Text
```
```csharp
private static readonly List basicNavBarItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Products", IconName = BitIconName.ProductVariant },
new() { Text = "Academy", IconName = BitIconName.LearningTools },
new() { Text = "Profile", IconName = BitIconName.Contact },
];
private BitNavBarItem? eventsClickedItem;
private BitNavBarItem? eventsSelectedItem;
```
\n**Binding**:
```razor
Selected item: @selectedItem.Text
```
```csharp
private static readonly List basicNavBarItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Products", IconName = BitIconName.ProductVariant },
new() { Text = "Academy", IconName = BitIconName.LearningTools },
new() { Text = "Profile", IconName = BitIconName.Contact },
];
private static IEnumerable> choiceGroupItems =
basicNavBarItems.Select(i => new BitChoiceGroupItem() { Id = i.Text, Text = i.Text, IsEnabled = i.IsEnabled, Value = i });
private BitNavBarItem selectedItem = basicNavBarItems[0];
private BitNavBarItem twoWaySelectedItem = basicNavBarItems[0];
```
\n**Reselectable**:
```razor
Item click count: @countClick
```
```csharp
private static readonly List basicNavBarItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Products", IconName = BitIconName.ProductVariant },
new() { Text = "Academy", IconName = BitIconName.LearningTools },
new() { Text = "Profile", IconName = BitIconName.Contact },
];
private int countClick;
private bool reselectable = true;
```
\n**Dynamic Items**:
```razor
Add item
Remove item
Reverse items
Selected item: @dynamicSelectedItem?.Text
```
```csharp
private int dynamicItemsCount = 3;
private BitNavBarItem? dynamicSelectedItem;
private readonly List dynamicNavBarItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Products", IconName = BitIconName.ProductVariant },
new() { Text = "Profile", IconName = BitIconName.Contact },
];
private void AddDynamicItem()
{
dynamicItemsCount++;
dynamicNavBarItems.Add(new() { Text = $"Item {dynamicItemsCount}", IconName = BitIconName.Tag });
}
private void RemoveDynamicItem()
{
if (dynamicNavBarItems.Count == 0) return;
dynamicNavBarItems.RemoveAt(dynamicNavBarItems.Count - 1);
}
private void ReverseDynamicItems() => dynamicNavBarItems.Reverse();
```
\n**External Icons**:
```razor
```
```csharp
private static readonly List externalIconItems =
[
new() { Text = "Home", Icon = "fa-solid fa-house" },
new() { Text = "Products", Icon = BitIconInfo.Css("fa-solid fa-box") },
new() { Text = "Academy", Icon = BitIconInfo.Fa("solid graduation-cap") },
new() { Text = "Profile", Icon = BitIconInfo.Fa("solid user") },
];
```
\n**Style & Class**:
```razor
```
```csharp
private static readonly List basicNavBarItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Products", IconName = BitIconName.ProductVariant },
new() { Text = "Academy", IconName = BitIconName.LearningTools },
new() { Text = "Profile", IconName = BitIconName.Contact },
];
private static readonly List styleClassItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Products", IconName = BitIconName.ProductVariant, Class = "custom-item" },
new() { Text = "Academy", IconName = BitIconName.LearningTools, Style = "color: #b6ff00;font-weight: 600;" },
new() { Text = "Profile", IconName = BitIconName.Contact },
];
private static readonly List badgeNavBarItems =
[
new() { Text = "Home", IconName = BitIconName.Home },
new() { Text = "Inbox", IconName = BitIconName.Mail, Badge = "12" },
new() { Text = "Alerts", IconName = BitIconName.Ringer, Badge = "99+", BadgeAriaLabel = "more than 99 unread alerts" },
new() { Text = "Profile", IconName = BitIconName.Contact, Dot = true, BadgeAriaLabel = "needs attention" },
];
```
@item.Text🎁
},
new() { Text = "Academy", IconName = BitIconName.LearningTools },
new() { Text = "Profile", IconName = BitIconName.Contact },
];
private static readonly List