Adding Pages
How to create new pages, add routes, and integrate them into the sidebar navigation.
How File-Based Routing Works
Nuxt uses file-based routing — every .vue file you create in the app/pages/ directory automatically becomes a route. There is no manual router configuration. The file path determines the URL:
| File Path | URL |
|---|---|
| pages/dashboard/reports.vue | /dashboard/reports |
| pages/orders/[id].vue | /orders/123 |
| pages/orders/[id]/edit.vue | /orders/123/edit |
| pages/index.vue | / |
Creating a New Dashboard Page
Create a new file at app/pages/dashboard/reports.vue. The page will immediately be available at /dashboard/reports and will automatically receive the default layout (sidebar + header):
Revenue breakdown for the current month.
New user signups over time.
That is all you need. The SharedPageHeader and SharedGlassCard components are auto-imported — no import statements required.
Dynamic Routes
Use square brackets in filenames for dynamic route segments. The parameter is accessible via useRoute().params:
Order details for {{ route.params.id }}
For nested dynamic routes like /orders/123/edit, create the file at pages/orders/[id]/edit.vue.
Page Meta & Layout Assignment
All pages use the default layout (sidebar + header) unless you specify otherwise. Use definePageMeta to assign a different layout or add middleware:
Login
Available Layouts
| Layout | When to Use |
|---|---|
| default | Dashboard pages, CRUD pages, settings (automatic, no config needed) |
| horizontal | Alternative dashboard layout with top navigation bar |
| auth | Classic login, register, forgot password |
| auth-split | Login/register with a split branding panel |
| auth-cover | Login/register with full-screen gradient background |
| marketing | Public-facing pages (landing, about, contact, FAQ, blog) |
| blank | Error pages, maintenance, coming soon |
Adding to Sidebar Navigation
To show your new page in the sidebar, open app/utils/navigation.ts and add an entry to the appropriate navigation group:
// app/utils/navigation.ts
export const navigation: NavGroup[] = [
{
label: 'Dashboards',
items: [
{ label: 'Overview', icon: 'i-lucide-layout-dashboard', to: '/dashboard' },
{ label: 'Analytics', icon: 'i-lucide-bar-chart-3', to: '/dashboard/analytics' },
// Add your new page here:
{ label: 'Reports', icon: 'i-lucide-file-bar-chart', to: '/dashboard/reports' },
],
},
// ... other groups
] Icons use the i-lucide-* prefix from the Lucide icon set. The sidebar renders all groups and items automatically.
Fetching Data
Use Nuxt's useFetch composable to load data from server API routes. This works during both SSR and client-side navigation:
Loading...{{ order.orderNumber }}Page {{ data?.meta.page }} of {{ data?.meta.lastPage }}
The mock API routes at /api/* support query parameters for page, per_page, search, status, sort, and order.
Full Example: Adding a Tasks Page
Here is a complete example that creates a tasks page with a data table, fetches from an API, and includes search and status filtering:
Loading... {{ task.title }}
Tip
You can scaffold a new page quickly with the Nuxt CLI: npx nuxi add page dashboard/reports. This creates the file with a basic template. Then just add your content and sidebar navigation entry.