Navigation Menu
A collection of links for navigating websites.
Usage
Import the component. It's mandatory to wrap the whole component with the Tailwind tag.
const { Tailwind } = VM.require("uiisnear.near/widget/tailwind");
const {
NavigationMenu,
NavigationMenuContent,
NavigationMenuItem,
NavigationMenuLink,
NavigationMenuList,
NavigationMenuTrigger,
navigationMenuTriggerClassname,
} = VM.require("uiisnear.near/widget/navigationMenu");
if (Tailwind == undefined) return "";
<Tailwind>
<NavigationMenu>
<NavigationMenuList>
<NavigationMenuItem>
<NavigationMenuTrigger>Item One</NavigationMenuTrigger>
<NavigationMenuContent>
<NavigationMenuLink>Link</NavigationMenuLink>
</NavigationMenuContent>
</NavigationMenuItem>
</NavigationMenuList>
</NavigationMenu>
</Tailwind>
API Reference
NavigationMenu
Contains all the parts of a navigation menu.
Prop | Type | Default |
---|---|---|
defaultValue | string | --- |
value | string | --- |
onValueChange | function | --- |
delayDuration | number | 200 |
skipDelayDuration | number | 300 |
dir | enum | 300 |
Data attribute | Values |
---|---|
[data-orientation] | "vertical" | "horizontal" |
NavigationMenuList
Contains the top level menu items.
Data attribute | Values |
---|---|
[data-orientation] | "vertical" | "horizontal" |
NavigationMenuItem
The button that toggles the content.
Prop | Type | Default |
---|---|---|
value | string | --- |
NavigationMenuTrigger
The button that toggles the content.
Data attribute | Values |
---|---|
[data-state] | "open" | "closed" |
[data-disabled] | Present when disabled |
NavigationMenuContent
Contains the content associated with each trigger.
Prop | Type | Default |
---|---|---|
disableOutsidePointerEvents | boolean | false |
onEscapeKeyDown | function | --- |
onPointerDownOutside | function | --- |
onFocusOutside | function | --- |
onInteractOutside | function | --- |
forceMount | boolean | --- |
Data attribute | Values |
---|---|
[data-state] | "open" | "closed" |
[data-motion] | "to-start" | "to-end" | "from-start" | "from-end" |
[data-orientation] | "vertical" | "horizontal" |
NavigationMenuLink
A navigational link.
Prop | Type | Default |
---|---|---|
active | boolean | false |
onSelect | function | --- |
Data attribute | Values |
---|---|
[data-active] | Present when active |
NavigationMenuIndicator
An optional indicator element that renders below the list, is used to highlight the currently active trigger.
Prop | Type | Default |
---|---|---|
forceMount | boolean | --- |
Data attribute | Values |
---|---|
[data-state] | "visible" | "hidden" |
[data-orientation] | "vertical" | "horizontal" |
NavigationMenuViewport
An optional viewport element that is used to render active content outside of the list.
Prop | Type | Default |
---|---|---|
forceMount | boolean | --- |
Data attribute | Values |
---|---|
[data-state] | "open" | "closed" |
[data-orientation] | "vertical" | "horizontal" |
Classnames
Classnames available to customize the component.
Function | Classname |
---|---|
NavigationMenu | navigationMenuClassname |
NavigationMenuList | navigationMenuListClassname |
NavigationMenuTrigger | navigationMenuTriggerClassname |
NavigationMenuContent | navigationMenuContentClassname |
NavigationMenuViewport | navigationMenuViewportClassname |
NavigationMenuIndicator | navigationMenuIndicatorClassname |