Skip to content

Add visible option to NavigationMenuItem for conditional rendering #4995

@anhthang

Description

@anhthang

Package

v4.0.0-alpha.x

Description

Currently, all NavigationMenuItem entries are always rendered if included in the items prop.
There is no built-in way to conditionally hide or show an item without removing it from the array.

This feature request adds a new boolean option visible to NavigationMenuItem.

export interface NavigationMenuItem {
  ...
  /**
   * Control whether the item should be rendered.
   * @defaultValue true
   */
  visible?: boolean
}
  • If visible: false → the item (and its children) will not be rendered in the menu.
  • If omitted, it defaults to true.

Additional context

  • Useful for conditionally hiding menu entries (e.g., based on permissions, feature flags, or environment).
  • Avoids the need to dynamically mutate the items array in parent components.
  • Keeps the developer experience simple and consistent with existing props.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttriageAwaiting initial review and prioritizationv4#4488

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions