The component can be imported via:
For expandable nav items:
For dropdown nav items:
The NavItem component accepts a href prop, just like other components
that extend from PlainLink.
Additionally, an icon can be provided to render an icon next to the label.
Use the isSelected prop to indicate the currently active nav item - for example,
to indicate the currently active page.
Use the isCollapsed prop to hide the label and only show the icon.
This can be used when collapsing a navigation sidebar for a condensed view.
NavItemExpandable, NavItemExpandableTrigger, and NavItemExpandableContent can be used
to create a group of nav items that can be expanded and collapsed.
NavItemExpandable is a wrapper component that provides the context for the
nested items. It doesn't render anything itself.
NavItemExpandableTrigger is a component that renders a NavItem which functions
as an expand/collapse toggle button for the section.
NavItemExpandableContent is the container for the nested items. When the section's
state is expanded, it will render the nested elements.
Use the defaultIsOpen prop to have the expandable section open by default.
NavItemDropdown, NavItemDropdownTrigger, and NavItemDropdownContent can be used
to create a group of nav items where a subset is shown inline (animated in/out based on
selection), and the rest are accessible via a dropdown menu triggered by the trigger item.
NavItemDropdown wraps the entire group.
NavItemDropdownContent contains the nav items that animate in when selected and
collapse when deselected.
NavItemDropdownTrigger renders a nav item that opens a dropdown menu containing
all the items from NavItemDropdownContent.
Which direction the arrow should point, if withArrow is true.
If this item is the trigger for an expandable section, this indicates whether any of the child items are selected.
The URL passed into the link component (or a tag)
The name of an icon (from Pluma Icons) to render in the nav item
Whether the nav item should render in the "collapsed" state, which hides the text and only shows the icon.
Whether the link should be disabled (this prevents click handlers from firing)
When this flag is true, an a tag will be used instead of the provider's linkComponent, even if it exists.
Additionally, target="_blank" rel="noopener noreferrer" will be added automatically
Whether this nav item is nested within another nav item.
Whether this nav item is currently active/selected,
which changes the item's appearance.
If provided, the component will render as a button and call this function when clicked.
This is passed into the provider's linkComponent.
It can be used by the link component implementation to handle replaceState instead of pushState
Whether an arrow icon should be rendered on the right side of the nav item,
indicating that this is a parent item that can be expanded to show child items.
This allows turning off the automatic addition of target="_blank" rel="noopener noreferrer".
This can be used for links to other protocols like mailto:
Whether the expandable section should be open by default.
Which direction the arrow should point, if withArrow is true.
If this item is the trigger for an expandable section, this indicates whether any of the child items are selected.
The URL passed into the link component (or a tag)
The name of an icon (from Pluma Icons) to render in the nav item
Whether the nav item should render in the "collapsed" state, which hides the text and only shows the icon.
Whether the link should be disabled (this prevents click handlers from firing)
When this flag is true, an a tag will be used instead of the provider's linkComponent, even if it exists.
Additionally, target="_blank" rel="noopener noreferrer" will be added automatically
Whether this nav item is nested within another nav item.
Whether this nav item is currently active/selected,
which changes the item's appearance.
If provided, the component will render as a button and call this function when clicked.
This is passed into the provider's linkComponent.
It can be used by the link component implementation to handle replaceState instead of pushState
Whether an arrow icon should be rendered on the right side of the nav item,
indicating that this is a parent item that can be expanded to show child items.
This allows turning off the automatic addition of target="_blank" rel="noopener noreferrer".
This can be used for links to other protocols like mailto: