Skip to content
GitHub11 stars

Navigation Menu

A collection of links and menus for website navigation.

<NavigationMenuRoot class="navigation-menu-root">
    <NavigationMenuList class="navigation-menu-list">
        <NavigationMenuItem>

Anatomy

Import the primitives and assemble the parts:

@using Blazix.Primitives

<NavigationMenuRoot>
    <NavigationMenuList>
        <NavigationMenuItem>
            <NavigationMenuTrigger>
                <NavigationMenuIcon />
            </NavigationMenuTrigger>
            <NavigationMenuContent>
                <NavigationMenuLink />
            </NavigationMenuContent>
        </NavigationMenuItem>
    </NavigationMenuList>

    <NavigationMenuPortal>
        <NavigationMenuBackdrop />
        <NavigationMenuPositioner>
            <NavigationMenuPopup>
                <NavigationMenuArrow />
                <NavigationMenuViewport />
            </NavigationMenuPopup>
        </NavigationMenuPositioner>
    </NavigationMenuPortal>
</NavigationMenuRoot>

API Reference

Doesn't render its own HTML element.

ParameterTypeDefault
Value string? -
ValueChanged

Called with the new value when Value changes, for @bind-Value.

EventCallback<string?> -
OnValueChange

Runs before the value changes, with the reason; call Cancel() to keep it.

EventCallback<ValueChangeEventArgs<string?>> -
Delay int 50
CloseDelay int 50
Orientation

Which way the parts are laid out, and which arrow keys move between them.

Orientation Orientation.Horizontal
Open bool false
OpenChanged

Called with the new value when Open changes, for @bind-Open.

EventCallback<bool> -
OnOpenChange EventCallback<OpenChangeEventArgs> -
OnOpenChangeComplete EventCallback<bool> -
Handle PopupHandle? -
ContentTemplate RenderFragment<object?>? -
ChildContent

The part's content.

RenderFragment? -

Renders a <button> element.

ParameterTypeDefault
Disabled

Whether the component should ignore user interaction.

bool false
NativeButton bool? -
Render RenderFragment<NavigationMenuItemRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-popup-open

Present when the corresponding navigation menu is open.

-
data-pressed

Present when the trigger is pressed.

-
data-disabled

Present when the trigger is disabled.

-

Renders a <span> element.

ParameterTypeDefault
Render RenderFragment<NavigationMenuItemRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-popup-open

Present when the navigation menu is open and the item is active.

-

Renders a <ul> element.

ParameterTypeDefault
Render RenderFragment<NavigationMenuRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

Doesn't render its own HTML element.

ParameterTypeDefault
KeepMounted bool false
ChildContent

The part's content.

RenderFragment? -

Renders a <div> element.

ParameterTypeDefault
Render RenderFragment<PopupRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-open

Present when the popup is open.

-
data-closed

Present when the popup is closed.

-
data-starting-style

Present when the popup begins animating in.

-
data-ending-style

Present when the popup is animating out.

-

Doesn't render its own HTML element.

ParameterTypeDefault
Side Side? -
Align Align? -
SideOffset int? -
AlignOffset int? -
CollisionPadding int? -
ArrowPadding int? -
Sticky bool? -
Anchor string? -
ChildContent

The part's content.

RenderFragment? -
AttributeType
data-open

Present when the popup is open.

-
data-closed

Present when the popup is closed.

-
data-anchor-hidden

Present when the anchor is hidden.

-
data-align

Indicates how the popup is aligned relative to the specified side.

'start' | 'center' | 'end'
data-instant

Present if animations should be instant.

-
data-side

Indicates which side the popup is positioned relative to the trigger.

'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'
CSS variableType
--anchor-height

The anchor's height.

number
--anchor-width

The anchor's width.

number
--available-height

The available height between the trigger and the edge of the viewport.

number
--available-width

The available width between the trigger and the edge of the viewport.

number
--positioner-height

The fixed height of the positioner element.

number
--positioner-width

The fixed width of the positioner element.

number
--transform-origin

The coordinates that this element is anchored to. Used for animations and transitions.

string

Renders a <div> element.

ParameterTypeDefault
Side Side? -
Align Align? -
SideOffset int? -
AlignOffset int? -
CollisionPadding int? -
ArrowPadding int 5
Sticky bool false
Anchor string? -
FallbackAxis bool? -
KeepMounted bool false
InitialFocus string? -
FinalFocus string? -
PositionerAttributes IReadOnlyDictionary<string, object>? -
Render RenderFragment<NavigationMenuRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-open

Present when the popup is open.

-
data-closed

Present when the popup is closed.

-
data-anchor-hidden

Present when the anchor is hidden.

-
data-align

Indicates how the popup is aligned relative to the specified side.

'start' | 'center' | 'end'
data-side

Indicates which side the popup is positioned relative to the trigger.

'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'
data-starting-style

Present when the popup begins animating in.

-
data-ending-style

Present when the popup is animating out.

-
CSS variableType
--popup-height

The fixed height of the popup element.

number
--popup-width

The fixed width of the popup element.

number

Renders a <div> element.

ParameterTypeDefault
Render RenderFragment<PopupRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-open

Present when the popup is open.

-
data-closed

Present when the popup is closed.

-
data-uncentered

Present when the popup arrow is uncentered.

-
data-align

Indicates how the popup is aligned relative to specified side.

'start' | 'center' | 'end'
data-side

Indicates which side the popup is positioned relative to the trigger.

'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'

Renders a <li> element.

ParameterTypeDefault
Value string? -
Render RenderFragment<NavigationMenuItemRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

Doesn't render its own HTML element.

ParameterTypeDefault
Render RenderFragment<NavigationMenuItemRenderProps>? -
ChildContent

The part's content.

RenderFragment? -
AttributeType
data-open

Present when the popup is open.

-
data-closed

Present when the popup is closed.

-
data-activation-direction

Which direction another trigger was activated from.

'left' | 'right' | 'up' | 'down'
data-starting-style

Present when the content begins animating in.

-
data-ending-style

Present when the content is animating out.

-

Renders a <div> element.

ParameterTypeDefault
Render RenderFragment<NavigationMenuRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

Renders a <a> element.

ParameterTypeDefault
Active bool false
CloseOnClick bool false
Render RenderFragment<NavigationMenuItemRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-active

Present when the link is the currently active page.

-