Custom dashboard pages
Pruvious allows you to customize the dashboard by adding new menu pages. You can do this by defining them in the dashboard
directory in your project's root.
Example
Here is an example of how to define a custom dashboard page:
# dashboard/analytics.ts
import { defineDashboardPage } from '#pruvious'
export default defineDashboardPage({
path: 'analytics',
vueComponent: './components/Dashboard/Analytics.vue',
icon: 'ChartBar',
capabilities: ['access-analytics'],
})
Dashboard pages are simple Vue components. Since the dashboard is a single-page application (SPA), the components will only be rendered in the browser.
Here's a boilerplate for a dashboard component:
# components/Dashboard/Analytics.vue
<template>
<PruviousBase>
<div class="scrollbar-thin overflow-auto p-8">
...
</div>
</PruviousBase>
</template>
Definition
The defineDashboardPage
function allows you to define the following properties (required properties are marked with the symbol R):
Property | Description |
---|---|
| The user capabilities required to access this page. Admin users can access all pages regardless of their capabilities. |
| The icon displayed in the dashboard menu for this page. You can find a list of all available icons here. |
| The label used for this page in the dashboard menu. When not provided, the label will be generated from the path (e.g., |
| The Vue route path used to render this page in the dashboard. For example, if you set it to |
| The priority of this page in the dashboard menu. Here is a list of the default menu priorities:
|
| The relative path of the Vue component that renders this page in the dashboard. The path should be relative to your Nuxt app directory. |
Last updated on January 20, 2024 at 16:33