Custom component only for non-admin users? #404
-
I would like to show the default components for Dashboard and Navigation if the user is an admin user and a custom component where I show only operations available to the user when a non-full admin user is logged in to the panel. I can handle the custom components for the non-admin users, I am unsure of how to render the default component for full admin users. (I have roles set up for user = admin / organization admin / etc). Sorry if this exists elsewhere in documentation, but I'm having trouble finding if this is possible. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @ryanlanciaux — You can definitely do this. You could import the default You can now import them via the following: import { Dashboard } from 'payload/components/views/Dashboard' import { Nav } from 'payload/components/elements' So what you'd do is provide your Payload config with custom components for the Dashboard and Nav views, perform your logic for which components to display to your logged in user, and then either render the default component or the custom component. How's that? |
Beta Was this translation helpful? Give feedback.
Hey @ryanlanciaux —
You can definitely do this. You could import the default
Dashboard
andNav
components from thepayload/dist
folder, but I just published a beta version (payload@0.13.11-beta.0
) that provides you with a more permanent way of importing those components.You can now import them via the following:
So what you'd do is provide your Payload config with custom components for the Dashboard and Nav views, perform your logic for which components to display to your logged in user, and then either render the default component or the custom component.
How's that?