Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide ability to disable Navigation links #4619

Open
vpmartin opened this issue Jan 20, 2025 · 1 comment
Open

Provide ability to disable Navigation links #4619

vpmartin opened this issue Jan 20, 2025 · 1 comment
Assignees
Labels
component: layout This is the name of the generic UI component, not the React module! scope: toolpad-core Abbreviated to "core"

Comments

@vpmartin
Copy link

vpmartin commented Jan 20, 2025

Summary

I think we should be able to disable the links provided as the navigation prop in the AppProvider, i.e. greyed-out with no link attached, but still present.

It is possible to programmatically not show some navigation links, based on some conditions, but it could lead to questions from users on eventual bugs causing some pages not to show.

It allows for a visual information of this page being inaccessible, instead of being not shown.

We could eventually add a customizable tooltip on the navigation item with an information message on why this app is disabled.

Examples

Unfortunately, I cannot share screenshots as the app is company property.

However, I could envision an optional disabled prop in every navigation segment that would allow for the segment to be displayed as disabled; like so:

{
  segment: 'orders',
  title: 'Orders',
  icon: <ShoppingCartIcon />,
  disabled: true
}

Motivation

In the app I am developing, the user has access to some settings in the AppBar through a multi-select dropdown menu. For the sake of simplicity, let's say this dropdown menu allows to select one or more subsystems to monitor in our system.

Some pages provided in the app only have meaning if the user selects only 1 value in this dropdown menu (very highly detailed monitoring of 1 subsystem, also sometimes subsystem-specific logic), while some other pages can display values for many subsystems (higher-level monitoring cards, that can be replicated for as many subsystems are selected as they do not take many space on screen).

The navigation is provided by our back-end through an API request, so this could be achievable by simply not returning 1-subsystem-specific navigation links.

However, I personally would prefer those links to be shown, but greyed-out, so that UX-wise, the user sees them but knows they are not accessible.

Search keywords: disable navigation link dashboardlayout

@vpmartin vpmartin added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 20, 2025
@apedroferreira
Copy link
Member

Sounds like an option we could add, thanks for creating this issue!

Instead of adding new properties to the navigation object used by the AppProvider, as these are features specific to the navigation sidebar in the layout, we're considering new callbacks as props in the DashboardLayout such as getNavigationItemDisabled or renderNavigationItem, similar to some props in https://mui.com/material-ui/api/autocomplete, for example.

@apedroferreira apedroferreira added scope: toolpad-core Abbreviated to "core" component: layout This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: layout This is the name of the generic UI component, not the React module! scope: toolpad-core Abbreviated to "core"
Projects
None yet
Development

No branches or pull requests

2 participants