Arrange navigation links vertically or horizontally.
import { Navbar } from '@fluxui-dev/react';<Navbar> <Navbar.Item href="#">Home</Navbar.Item> <Navbar.Item href="#">Features</Navbar.Item> <Navbar.Item href="#">Pricing</Navbar.Item> <Navbar.Item href="#">About</Navbar.Item></Navbar>
Navbars and navlists will try to automatically detect and mark the current page based on the href passed in; see the Inertia guide. An item also matches the pages under it, so /settings is current on /settings/profile; the query string and trailing slashes are ignored. However, if you need full control, you can pass the current prop to the item directly.
<Navbar.Item href="/">Home</Navbar.Item><Navbar.Item href="/" current>Home</Navbar.Item><Navbar.Item href="/" current={false}>Home</Navbar.Item>
Add leading icons for visual context.
import { CurrencyDollarIcon, HomeIcon, PuzzlePieceIcon, UserIcon } from '@fluxui-dev/react/icons';<Navbar> <Navbar.Item href="#" icon={HomeIcon}>Home</Navbar.Item> <Navbar.Item href="#" icon={PuzzlePieceIcon}>Features</Navbar.Item> <Navbar.Item href="#" icon={CurrencyDollarIcon}>Pricing</Navbar.Item> <Navbar.Item href="#" icon={UserIcon}>About</Navbar.Item></Navbar>
Add a trailing badge to a navbar item using the badge prop, or pass a Navbar.Badge element to change its color.
<Navbar> <Navbar.Item href="#">Home</Navbar.Item> <Navbar.Item href="#" badge="12">Inbox</Navbar.Item> <Navbar.Item href="#">Contacts</Navbar.Item> <Navbar.Item href="#" badge={<Navbar.Badge color="lime">Pro</Navbar.Badge>}>Calendar</Navbar.Item></Navbar>
Condense multiple navigation items into a single dropdown menu to save on space and group related items.
import { Dropdown, Navbar } from '@fluxui-dev/react';import { ChevronDownIcon } from '@fluxui-dev/react/icons';<Navbar> <Navbar.Item href="#">Dashboard</Navbar.Item> <Navbar.Item href="#">Transactions</Navbar.Item> <Dropdown> <Dropdown.Trigger> <Navbar.Item iconTrailing={ChevronDownIcon}>Account</Navbar.Item> </Dropdown.Trigger> <Dropdown.Menu> <Dropdown.Item href="#">Profile</Dropdown.Item> <Dropdown.Item href="#">Settings</Dropdown.Item> <Dropdown.Item href="#">Billing</Dropdown.Item> </Dropdown.Menu> </Dropdown></Navbar>
Arrange your navbar vertically using the Navlist component.
import { Navlist } from '@fluxui-dev/react';<Navlist className="w-64"> <Navlist.Item href="#" icon={HomeIcon}>Home</Navlist.Item> <Navlist.Item href="#" icon={PuzzlePieceIcon}>Features</Navlist.Item> <Navlist.Item href="#" icon={CurrencyDollarIcon}>Pricing</Navlist.Item> <Navlist.Item href="#" icon={UserIcon}>About</Navlist.Item></Navlist>
Group related navigation items.
<Navlist className="w-64"> <Navlist.Group heading="Account" className="mt-4"> <Navlist.Item href="#">Profile</Navlist.Item> <Navlist.Item href="#">Settings</Navlist.Item> <Navlist.Item href="#">Billing</Navlist.Item> </Navlist.Group></Navlist>
Group related navigation items into collapsible sections using the expandable prop.
import { HomeIcon, ListBulletIcon } from '@fluxui-dev/react/icons';<Navlist className="w-64"> <Navlist.Item href="#" icon={HomeIcon}>Dashboard</Navlist.Item> <Navlist.Item href="#" icon={ListBulletIcon}>Transactions</Navlist.Item> <Navlist.Group heading="Account" expandable> <Navlist.Item href="#">Profile</Navlist.Item> <Navlist.Item href="#">Settings</Navlist.Item> <Navlist.Item href="#">Billing</Navlist.Item> </Navlist.Group></Navlist>
If you want a group to be collapsed by default, you can use the defaultOpen prop:
<Navlist.Group heading="Account" expandable defaultOpen={false}>
Show additional information related to a navlist item using the badge prop, or pass a Navlist.Badge element for a colored badge.
import { CalendarDaysIcon, EnvelopeIcon, HomeIcon, UserGroupIcon } from '@fluxui-dev/react/icons';<Navlist className="w-64"> <Navlist.Item href="#" icon={HomeIcon}>Home</Navlist.Item> <Navlist.Item href="#" icon={EnvelopeIcon} badge="12">Inbox</Navlist.Item> <Navlist.Item href="#" icon={UserGroupIcon}>Contacts</Navlist.Item> <Navlist.Item href="#" icon={CalendarDaysIcon} badge={<Navlist.Badge color="lime">Pro</Navlist.Badge>}>Calendar</Navlist.Item></Navlist>
A horizontal navigation container.
|
Prop
|
Description
|
|---|---|
| scrollable |
If true, allows the navbar to scroll horizontally instead of overflowing when items do not fit.
|
|
Attribute
|
Description
|
|---|---|
| data-flux-navbar |
Applied to the root element for styling and identification.
|
|
Prop
|
Description
|
|---|---|
| href |
URL the item links to. When set, the item renders as an a tag. An in-app URL navigates through the link registered in FluxProvider.
|
| render |
Element to render instead of the item (such as a router link with props href can't carry), with the item's props merged in. Also accepts a function that receives the props and returns an element.
|
| current |
If true, applies active styling and sets aria-current="page". Without it, the item is current when its href matches FluxProvider's currentUrl.
|
| icon |
Icon component or element to display at the start of the item.
|
| iconTrailing |
Icon component or element to display at the end of the item.
|
| iconVariant |
Variant of the item's icons: outline, solid, mini, or micro. Default: outline.
|
| iconDot |
If true, displays a small dot on the icon, such as for unread notifications.
|
| badge |
Content to display as a badge. Can be a string, number, or a Navbar.Badge element.
|
| accent |
If false, the current item uses zinc instead of the accent color. Default: true.
|
| square |
Applies equal padding on all sides for items without text, defaulting to true when the item has no children.
|
|
Attribute
|
Description
|
|---|---|
| data-flux-navbar-items |
Applied to the root element for styling and identification.
|
| data-current |
Applied when the item is active/current.
|
The badge rendered by Navbar.Item for text in its badge prop; pass it as badge to set a color or variant, or use it on its own.
|
Prop
|
Description
|
|---|---|
| color |
Color of the badge, accepting zinc, gray (the same as zinc), or any of the 17 named colors such as red, lime, or blue, and defaulting to zinc when omitted.
|
| variant |
Variant of the badge: default (a soft tint) or solid. Default: default.
|
A vertical navigation container (sidebar).
|
Prop
|
Description
|
|---|---|
| variant |
Visual style applied to all items inside: default or outline, which gives the current item a white, bordered background.
|
|
Attribute
|
Description
|
|---|---|
| data-flux-navlist |
Applied to the root element for styling and identification.
|
|
Prop
|
Description
|
|---|---|
| href |
URL the item links to. When set, the item renders as an a tag. An in-app URL navigates through the link registered in FluxProvider.
|
| render |
Element to render instead of the item (such as a router link with props href can't carry), with the item's props merged in. Also accepts a function that receives the props and returns an element.
|
| current |
If true, applies active styling and sets aria-current="page". Without it, the item is current when its href matches FluxProvider's currentUrl.
|
| icon |
Icon component or element to display at the start of the item.
|
| iconTrailing |
Icon component or element to display at the end of the item.
|
| iconVariant |
Variant of the item's icons: outline, solid, mini, or micro. Default: outline.
|
| iconDot |
If true, displays a small dot on the icon, such as for unread notifications.
|
| badge |
Content to display as a badge. Can be a string, number, or a Navlist.Badge element.
|
| accent |
If false, the current item uses zinc instead of the accent color. Default: true.
|
| variant |
Overrides the variant set on the surrounding Navlist.
|
|
Attribute
|
Description
|
|---|---|
| data-flux-navlist-item |
Applied to the root element for styling and identification.
|
| data-current |
Applied when the item is active/current.
|
|
Prop
|
Description
|
|---|---|
| heading |
Text displayed as the group heading.
|
| expandable |
If true, makes the group collapsible.
|
| defaultOpen |
If true, expands the group by default when expandable. Default: true.
|
| open |
Controlled expanded state of an expandable group. Pair with onOpenChange.
|
| onOpenChange |
Callback fired when an expandable group expands or collapses, receiving the new open state.
|
|
Attribute
|
Description
|
|---|---|
| data-flux-navlist-group |
Applied to the root element of an expandable group.
|
| data-open |
Applied to an expandable group while it is expanded.
|
The badge rendered by Navlist.Item and Sidebar.Item for text in their badge prop; pass it as badge to set a color or variant, or use it on its own.
|
Prop
|
Description
|
|---|---|
| color |
Color of the badge, accepting zinc, gray (the same as zinc), or any of the 17 named colors such as red, lime, or blue, and defaulting to zinc when omitted.
|
| variant |
Variant of the badge: default (a soft tint) or solid. Default: default.
|
|
Attribute
|
Description
|
|---|---|
| data-flux-navlist-badge |
Applied to the root element for styling and identification.
|