Skip to content
# NavBar **Also known as:** NavMenu, TabPanel ## Description A bar of navigation links to the main areas of an app - the bottom navigation of a mobile app, or a navigation rail down its side. ## Parameters | Name | Type | Default Value | Description | | :--- | :--- | :------------ | :---------- | | Alignment | `BitAlignment?` | null | How the items are distributed along the navbar. Unset, a bar spreads its items evenly and a vertical rail packs them at its top; Baseline and Stretch keep that default. | | AutoReorderOptions | `bool` | false | Keeps the order of the options (what the keyboard walks) 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. | | 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. An explicit value wins over the --bit-NavBar-* hover, selected, indicator, disabled and focus color variables; left unset, the navbar is primary unless they say otherwise. | | DefaultSelectedItem | `TItem?` | null | The initially selected item in manual mode. Ignored while SelectedItem or SelectedKey is bound. | | DefaultSelectedKey | `string?` | null | The Key of the initially selected item in manual mode, applied as soon as an item with that key is there. It is how the options API sets a default selection. DefaultSelectedItem wins when both are set, and both are ignored while SelectedItem or SelectedKey is bound. | | Filled | `bool` | false | Fills the hovered and the selected item with the Color of the navbar, moving their content onto its on-color. | | FitWidth | `bool` | false | Renders the nav bar in a width to only fit its content. | | FlipIndicator | `bool` | false | Draws the Line indicator on the opposite edge: the top edge of a bar (the one a bottom bar turns toward the content) and the trailing edge of a Vertical rail. | | FooterTemplate | `RenderFragment?` | null | Content rendered after the items, outside their list: trailing actions of a bar, or the bottom button of a rail. | | FullWidth | `bool` | false | Renders the nav bar in full width of its container element. | | HeaderTemplate | `RenderFragment?` | null | Content rendered before the items, outside their list: a logo or a menu button, or the top button of a rail. | | HideUnselectedText | `bool` | false | Only renders the text of the selected item; the others keep their icon, and their text as their accessible name. Ignored while IconOnly is enabled. | | IconOnly | `bool` | false | Only renders the icon of each item; the text becomes its accessible name and tooltip. | | Indicator | `BitNavBarIndicator?` | null | The mark of the selected item beside its color: a Line along its edge or a Pill behind its icon. | | 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 renders inside the anchor (or button) of each item, or replaces it for items that are controls of their own. Replaced items own their clicks, focus and accessible name, and are left out of the keyboard navigation. | | Justified | `bool` | false | Gives every item an equal share of the navbar instead of 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. | | 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. | | 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. | | OnSelectItem | `EventCallback<TItem>` | | Callback invoked when an item is selected. | | Options | `RenderFragment?` | null | Alias of ChildContent. | | Reselectable | `bool` | false | Lets the click and select events of the already selected item through, on a click in the Manual mode and on a navigation back to its URL in the Automatic mode. | | SafeArea | `bool` | false | Reserves the bottom safe-area inset of the device (a phone's home indicator) under the items, so a bar pinned to the bottom of the screen is not overlapped by it. | | Scrollable | `bool` | false | Scrolls the items along the navbar instead of squeezing them, with the scrollbar hidden and a mouse wheel scrolling a horizontal bar sideways, and keeps the selected item in view as the selection moves. | | SelectedItem | `TItem?` | null | Selected item to show in the navbar. Supports two-way binding. | | SelectedKey | `string?` | null | The Key of the selected item, kept in step with SelectedItem. It is how the options API binds its selection; a key no item carries yet is applied once one with it is there. Bound one way, it holds the selection as a one-way SelectedItem does. Automatic mode only reports it. Supports two-way binding. | | SelectOnFocus | `bool` | false | Selects an item as soon as the focus reaches it, like the tabs of a tab list. Manual mode only. | | SingleTabStop | `bool` | false | Makes the navbar a single tab stop (the last focused item, else the selected one, else the first) with the arrow keys moving inside it, like a toolbar. By default every item is a tab stop. | | Size | `BitSize?` | null | The size of the navbar. An explicit value wins over the --bit-NavBar-* item padding, minimum size, icon size and text size variables; left unset, the navbar is medium unless they say otherwise. | | 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 from the last item to the first one and back. By default the focus stops at the ends. | | 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 | | :--- | :--- | :------------ | :---------- | | 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 or focusing it. | | 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 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. | ### 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, 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. | ### 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 opposite ones with FlipIndicator), 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. | ### 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. | ### 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 ### 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. | | IsDisabled | `bool` | false | Whether or not the navbar item is disabled. | | Key | `string?` | null | A unique value to use as a key or id of the navbar item, and what the DefaultSelectedKey of the navbar matches. | | 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. | | Rel | `BitLinkRels?` | null | The rel attribute of the link of the navbar 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 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. | | IsDisabled | `bool` | false | Whether or not the navbar option is disabled. | | Key | `string?` | null | A unique value to use as a key or id of the navbar option, and what the DefaultSelectedKey of the navbar matches. | | 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. | | Rel | `BitLinkRels?` | null | The rel attribute of the link of the navbar 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 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. | | IsDisabled | `BitNameSelectorPair<TItem, bool?>` | new(nameof(BitNavBarItem.IsDisabled)) | The IsDisabled 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. | | Rel | `BitNameSelectorPair<TItem, BitLinkRels?>` | new(nameof(BitNavBarItem.Rel)) | The Rel field name and selector of the custom input class. | | 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. | ## 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-NavBar-background` | transparent | Fill of the bar. | | `--bit-NavBar-border-radius` | 0 | Corners of the bar, for a floating tab bar. | | `--bit-NavBar-shadow` | none | Shadow of the bar. | | `--bit-NavBar-padding-block` | 0 | Room above and below the items (SafeArea adds the device inset below it). | | `--bit-NavBar-padding-inline` | 0 | Room on the two sides of the items. | | `--bit-NavBar-gap` | 0 | Space between the items. | | `--bit-NavBar-item-color` | --bit-clr-fg-pri | Content color of an item. | | `--bit-NavBar-item-hover-color` | --bit-clr-pri (--bit-clr-pri-text when Filled) | Content color of a hovered item. The Color parameter wins over it. | | `--bit-NavBar-item-hover-background` | transparent (--bit-clr-pri-hover when Filled) | Fill of a hovered item, or of its pill with the Pill indicator. The Color parameter wins over it when Filled; the transparent fill of an unfilled bar is its alone. | | `--bit-NavBar-item-border-radius` | --bit-shp-radius-control | Corners of an item. | | `--bit-NavBar-item-padding` | spacing(1) (spacing(2) on a single line) | Padding of an item, one length on every side (the room a hidden label reserves is worked out from it). The Size parameter wins over it. | | `--bit-NavBar-item-min-size` | --bit-siz-ctrl-md | Minimum width and height of an item, its touch target. The Size parameter wins over it. | | `--bit-NavBar-icon-size` | --bit-tpg-fs-md | Size of the icon of an item. The Size parameter wins over it. | | `--bit-NavBar-text-size` | --bit-tpg-fs-sm | Font size of the text of an item. The Size parameter wins over it. | | `--bit-NavBar-selected-color` | --bit-clr-pri (--bit-clr-pri-text when Filled) | Content color of the selected item. The Color parameter wins over it. | | `--bit-NavBar-selected-background` | transparent, --bit-clr-bg-ter for the pill (--bit-clr-pri-active when Filled) | Fill of the selected item, or of its pill with the Pill indicator. The Color parameter wins over it when Filled; the unfilled fill is its alone. | | `--bit-NavBar-selected-font-weight` | --bit-tpg-fw-semibold | Font weight of the selected item. | | `--bit-NavBar-indicator-color` | --bit-clr-pri (--bit-clr-pri-text when Filled) | Color of the Line indicator. The Color parameter wins over it. | | `--bit-NavBar-indicator-thickness` | --bit-siz-tab-indicator | Thickness of the Line indicator. | | `--bit-NavBar-indicator-inset` | 0 | Inset of the Line indicator from both ends of the item, for a line shorter than the item. | | `--bit-NavBar-badge-color` | --bit-clr-err-text | Text color of a badge. | | `--bit-NavBar-badge-background` | --bit-clr-err | Fill of a badge and a dot. | | `--bit-NavBar-disabled-color` | --bit-clr-pri-dis-text | Content color of a disabled item. The Color parameter wins over it. | | `--bit-NavBar-focus-color` | --bit-clr-pri-focus | Color of the focus ring of an item. The Color parameter wins over it. While it is unset, the focus ring is the library's own --bit-shd-focus-ring, so replacing that token re-shapes it too. | ## Examples
\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 = "Calendar", IconName = BitIconName.Calendar }, new() { Text = "Chat", IconName = BitIconName.Chat }, new() { Text = "People", IconName = BitIconName.People }, new() { Text = "News", IconName = BitIconName.News }, new() { Text = "Photos", IconName = BitIconName.Photo2 }, new() { Text = "Videos", IconName = BitIconName.Video }, new() { Text = "Music", IconName = BitIconName.MusicNote }, new() { Text = "Documents", IconName = BitIconName.Document }, new() { Text = "Cloud", IconName = BitIconName.Cloud }, new() { Text = "Maps", IconName = BitIconName.MapPin }, 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) => @
@item.Text🎁
}, new() { Text = "Academy", IconName = BitIconName.LearningTools }, new() { Text = "Profile", IconName = BitIconName.Contact }, ]; private static readonly List 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 (@clickCount clicks)
Selected item: @eventsSelectedItem?.Text (@selectCount selections)
``` ```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 bool reselectable; private int clickCount; private int selectCount; private BitNavBarItem? eventsClickedItem; private BitNavBarItem? eventsSelectedItem; ``` \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" }, ]; ```