### Project Setup with Create Next App Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/overview/installation This section outlines the initial steps for setting up a new Next.js project using the `create-next-app` command. It's the foundation for integrating the Materialize template. ```bash npx create-next-app@latest my-app --typescript --eslint --app --src-dir --tailwind --import-alias "@/*" cd my-app pnpm install ``` -------------------------------- ### Component Location Example Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/apps-and-pages-setup/apps Illustrates the directory structure for application components within the template. It shows where to find existing app components and provides an example for the Invoice app. ```javascript src/views/apps src/views/apps/invoice ``` -------------------------------- ### Project Launch Commands Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/overview/installation Commands to start the development server for the Materialize Next.js Admin Template. The commands vary based on the package manager used. You can also specify a custom port using the --port or -p flag. ```bash pnpm dev ``` ```bash yarn dev ``` ```bash npm run dev ``` -------------------------------- ### Styling Approach Example Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/apps-and-pages-setup/apps Demonstrates the recommended styling methodology, prioritizing Tailwind CSS classes. It also shows the alternative of using CSS Modules for custom styles when Tailwind is insufficient, with a specific example for the Invoice app's styling. ```css src/views/apps/invoice/preview/styles.module.css ``` -------------------------------- ### Materialize Template Installation Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/overview/installation Instructions for installing the Materialize template, including cloning the repository and installing dependencies. This assumes you have Git installed. ```bash # Clone the repository git clone https://github.com/pixinvent/materialize-nextjs-admin-template.git cd materialize-nextjs-admin-template # Install dependencies using pnpm (recommended) pnpm install # Or using npm npm install # Or using yarn yarn install ``` -------------------------------- ### FAQs: Installation and Project Setup Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/faqs/why-cannot-revert-to-default-theme Covers common issues encountered during the installation process, including errors and warnings. It also touches upon integrating the template into existing projects. ```markdown - Installation errors - Installation warnings - How to integrate this template into my existing project? - How to Configure Local Template to look like one of the 6 demos you see online? ``` -------------------------------- ### FAQ API Route (GET) Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/apps-and-pages-setup/pages An example of a Next.js API route handler for fetching FAQ data. It imports data from a fake database and returns it as JSON. ```typescript import{NextResponse}from'next/server'; import{ db }from'@/app/api/fake-db/pages/faq'; exportasyncfunctionGET(){ returnNextResponse.json(db); } ``` -------------------------------- ### File Path Example: TypeScript vs. JavaScript Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/overview/getting-started Illustrates the difference in file paths for a common component between TypeScript and JavaScript versions of the template. This is crucial for JavaScript users to correctly reference components. ```typescript src/components/Providers.tsx ``` ```javascript src/components/Providers.jsx ``` -------------------------------- ### Dependency Installation Commands Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/overview/installation Commands to install project dependencies using different package managers. pnpm is highly recommended for optimal performance and dependency management. ```bash pnpm install ``` ```bash yarn install ``` ```bash npm install ``` -------------------------------- ### Materialize Template Project Scenarios Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/overview/getting-started This section details the two primary scenarios for using the Materialize Next.js Admin Template: starting a new project or integrating into an existing one. It emphasizes that the template is designed as a starter project and recommends starting new projects with it or migrating existing projects onto it for the optimal experience, while acknowledging that integration into existing projects is possible but requires extra effort. ```APIDOC Materialize Next.js Admin Template Usage Scenarios: 1. Starting a New Project: - The template serves as a robust starting point. 2. Integrating into an Existing Project: - The template is a starter project, not a library for simple installation. - Integration requires extra work to connect all components. - Recommendation: Start new projects with Materialize or migrate existing projects onto it for the best experience. ``` -------------------------------- ### Next.js API Setup Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/apps-and-pages-setup/apps Information regarding the setup and usage of the Next.js API within the Materialize Admin Template. This section likely covers API routes, data fetching, and server-side logic. ```javascript /* This section would typically contain code examples for setting up Next.js API routes, handling requests, and managing server-side data. For example: // pages/api/users.js export default function handler(req, res) { if (req.method === 'GET') { // Fetch users from a database or external API const users = [{ id: 1, name: 'John Doe' }]; res.status(200).json(users); } else { res.setHeader('Allow', ['GET']); res.status(405).end(`Method ${req.method} Not Allowed`); } } */ ``` -------------------------------- ### Template Version Specification Examples Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/overview/getting-support Examples of how to specify the template version when seeking support, including combinations of TypeScript/JavaScript and Full Version/Starter Kit. ```APIDOC TypeScript + Full Version Javascript + Starter Kit ``` -------------------------------- ### Vertical Navigation Examples Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/menu-examples/vertical-examples/vertical-nav/background-image This section covers various configurations and customizations for the vertical navigation menu. It includes examples for basic setup, width adjustments, breakpoint behavior, background styling, and overlay effects. ```APIDOC Vertical Nav Basic: Description: Basic vertical navigation setup. Vertical Nav Width: Description: Adjusting the width of the vertical navigation. Vertical Nav Collapsed Width: Description: Setting the width of the vertical navigation when collapsed. Vertical Nav Breakpoint: Description: Defining the screen breakpoint for vertical navigation behavior. Vertical Nav Breakpoints: Description: Configuring multiple breakpoints for responsive vertical navigation. Vertical Nav Custom Breakpoint: Description: Implementing a custom screen breakpoint for the vertical navigation. Vertical Nav Transition Duration: Description: Setting the transition duration for vertical navigation animations. Vertical Nav Background Color: Description: Customizing the background color of the vertical navigation. Vertical Nav Background Image: Description: Applying a background image to the vertical navigation. Vertical Nav Overlay Menu: Description: Enabling an overlay effect for the vertical navigation. Vertical Nav Backdrop Color: Description: Customizing the backdrop color when the overlay menu is active. Vertical Nav Custom Style: Description: Applying custom styles to the vertical navigation. ``` -------------------------------- ### Deployment Guide Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/home-page-url Instructions and considerations for deploying the Materialize Next.js Admin Template to various hosting platforms. This may include build commands and environment variable setup for production. ```javascript # Production build command npm run build # Start production server (e.g., using Node.js) NODE_ENV=production node server.js ``` -------------------------------- ### Redux Store Setup Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/folder-structure Describes the Redux store configuration, including the provider, central store setup, and individual Redux slices for state management. ```typescript // src/redux-store/ReduxProvider.tsx // Redux provider ``` ```typescript // src/redux-store/index.ts // Central Redux store configuration, combines all reducers and configures middleware ``` ```typescript // src/redux-store/slices // Redux slices (individual pieces of state) ``` -------------------------------- ### Vertical Menu Examples Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/menu-examples/vertical-examples/menu Provides examples and configurations for different vertical menu behaviors and styles. This includes basic menu setup, popout effects when collapsed, transition durations, and styling for menu sections and items. ```javascript /* Example for Popout When Collapsed: This configuration enables a popout effect for menu items when the vertical menu is collapsed. */ // Assuming a configuration object or state management is used { collapsedMenu: { popout: true } } /* Example for Transition Duration: Sets the duration for menu item transitions (e.g., opening/closing submenus). */ { menuTransition: { duration: '0.3s' } } /* Example for Menu Section Style: Applies custom styles to menu sections. */ { menuSectionStyle: { fontSize: '0.875rem', fontWeight: 600, color: '#6366f1' // Example color } } /* Example for Menu Item Styles: Applies custom styles to individual menu items. */ { menuItemStyle: { padding: '0.5rem 1rem', borderRadius: '0.375rem' } } /* Example for Sub Menu Open Behavior: Defines how submenus behave when their parent item is interacted with. */ { subMenuOpenBehavior: 'accordion' // or 'dropdown' } /* Example for Expand Menu Icon: Specifies the icon used to indicate an expandable menu item. */ { expandMenuIcon: 'M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' } /* Example for Expanded Menu Item Icon: Specifies the icon shown when a menu item's submenu is expanded. */ { expandedMenuItemIcon: 'M10 15a.5.5 0 01-.5-.5v-4h-4a.5.5 0 010-1h4v-4a.5.5 0 011 1v4h4a.5.5 0 010 1h-4v4a.5.5 0 01-.5.5z' } /* Example for Popout Menu Offset: Adjusts the positioning of popout menus relative to the collapsed menu. */ { popoutMenuOffset: { x: 10, y: 0 } } /* Example for Text Truncate: Enables text truncation for menu item labels that exceed a certain width. */ { textTruncate: { enabled: true, maxLength: 20 } } /* Example for Root Styles: Applies styles to the root element of the menu component. */ { rootStyles: { width: '250px', backgroundColor: '#ffffff' } } ``` -------------------------------- ### Next.js API Setup Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/apps-and-pages-setup/pages Information on how to set up and utilize the Next.js API within the Materialize Admin Template. This section likely details file structure for API routes and basic usage patterns. ```javascript // Example of a Next.js API route setup // pages/api/hello.js export default function handler(req, res) { res.status(200).json({ text: 'Hello' }); } ``` -------------------------------- ### Horizontal Menu Examples Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/menu-examples/horizontal-examples/menu Provides examples and configurations for horizontal menu components within the Materialize Next.js Admin Template. Covers basic setup, popout triggers, transition durations, item styling, offsets, icons, and text truncation. ```jsx import HorizontalNav from '@components/horizontal-nav'; import Menu from '@components/menu'; // Example Usage for Horizontal Nav // Example Usage for Menu with various configurations +} expandedMenuItemIcon={-} textTruncate verticalMenuProps={{ // Props for vertical menu behavior if needed }} rootStyles={{ backgroundColor: '#f0f0f0' }} /> ``` -------------------------------- ### Vertical Navigation Examples Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/menu-examples/vertical-examples/vertical-nav This section covers various configurations and customizations for vertical navigation menus. It includes examples for basic setup, width adjustments, collapsed states, breakpoints, transition durations, background styling, overlay effects, and custom styling. ```html ``` ```css .vertical-nav { width: 250px; transition: width 0.3s ease; } .vertical-nav.collapsed { width: 60px; } ``` -------------------------------- ### Theming Overview Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/apps-and-pages-setup/pages An overview of the theming capabilities in the Materialize Next.js Admin Template. This section likely covers how to customize the appearance, including colors, typography, and layout. ```javascript // Example of importing and using theme variables // components/MyComponent.js import { useTheme } from '@mui/material/styles'; function MyComponent() { const theme = useTheme(); return (
Styled Content
); } ``` -------------------------------- ### Configuring Local Template like Demos Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/faqs/remove-nextjs Guides users on how to configure their local setup of the Materialize Next.js Admin Template to closely resemble the online demo versions. ```markdown How to Configure Local Template to look like one of the 6 demos you see online? https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/faqs/configure-local-template-like-demos ``` -------------------------------- ### Vertical Navigation Examples Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/menu-examples/vertical-examples/vertical-nav/collapsed-width Demonstrates various configurations for vertical navigation menus, including basic setup, width adjustments, breakpoint handling, transition durations, background styling, overlay effects, and custom styles. ```html ``` -------------------------------- ### Fetch FAQ Data (Client-side) Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/apps-and-pages-setup/pages Demonstrates how to fetch FAQ data from an API using the fetch API in a Next.js server component. It includes error handling for failed requests. ```javascript constgetFaqData=async()=>{ const res =awaitfetch(`${process.env.API_URL}/pages/faq`);// Your API URL if(!res.ok){ thrownewError('Failed to fetch faqData'); } return res.json(); }; constFAQPage=async()=>{ const data =awaitgetFaqData(); return; }; exportdefaultFAQPage ``` -------------------------------- ### Vertical Navigation Examples Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/menu-examples/vertical-examples/vertical-nav/custom-breakpoint Examples demonstrating various configurations for vertical navigation in the Materialize Next.js Admin Template. This includes basic setup, width adjustments, collapsed states, custom breakpoints, transition durations, background styling, overlay effects, and custom CSS. ```javascript /* Basic Vertical Nav Configuration */ // Example: Setting up a simple vertical navigation. /* Width Configuration */ // Example: Adjusting the width of the vertical navigation. /* Collapsed Width Configuration */ // Example: Defining the width when the navigation is collapsed. /* Breakpoint Configuration */ // Example: Setting a custom breakpoint for navigation behavior. /* Custom Breakpoint Configuration */ // Example: Implementing a specific breakpoint for responsive adjustments. /* Transition Duration */ // Example: Controlling the speed of navigation transitions. /* Background Color */ // Example: Applying a custom background color to the navigation. /* Background Image */ // Example: Using a background image for the navigation. /* Overlay Menu */ // Example: Enabling an overlay effect for the navigation. /* Backdrop Color */ // Example: Setting the color of the backdrop when the menu is active. /* Custom Style */ // Example: Applying custom styles to the navigation elements. ``` -------------------------------- ### Horizontal Menu Examples Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/menu-examples/horizontal-examples/menu/transition-duration Examples demonstrating different configurations and styles for horizontal menus within the Materialize Next.js Admin Template. This includes basic setup, popout triggers, transition durations, item styling, offsets, icons, text truncation, and root styles. ```javascript /* This section details various configurations for horizontal menus. It covers aspects like: - Basic menu structure - Triggering popout menus - Setting transition durations for menu animations - Styling individual menu items - Adjusting popout menu offsets - Customizing expand menu icons - Handling expanded menu item icons - Text truncation for long menu item labels - Props for vertical menu integration - Applying root styles to the menu component */ // Example: Setting transition duration for a horizontal menu item // const menuConfig = { // transitionDuration: 300 // milliseconds // }; // Example: Styling a menu item // const menuItemStyle = { // color: '#ffffff', // backgroundColor: '#007bff' // }; // Example: Text truncation // const truncatedText = "This is a very long menu item label that needs to be truncated"; ``` -------------------------------- ### Vertical Submenu Examples Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/menu-examples/vertical-examples/submenu/on-open-change Demonstrates various configurations for vertical submenus within the Materialize Next.js Admin Template. Includes examples for basic setup, icons, default open states, disabled menus, prefix/suffix elements, component integration, classname customization, click events, open change handling, and root styling. ```jsx import React from 'react'; const SubMenuBasic = () => { return (
{/* Basic submenu content */}
); }; export default SubMenuBasic; ``` ```jsx import React from 'react'; const SubMenuIcon = () => { return (
{/* Submenu with icons */}
); }; export default SubMenuIcon; ``` ```jsx import React from 'react'; const SubMenuDefaultOpen = () => { return (
{/* Submenu that is open by default */}
); }; export default SubMenuDefaultOpen; ``` ```jsx import React from 'react'; const SubMenuDisabled = () => { return (
{/* Disabled submenu */}
); }; export default SubMenuDisabled; ``` ```jsx import React from 'react'; const SubMenuPrefix = () => { return (
{/* Submenu with a prefix element */}
); }; export default SubMenuPrefix; ``` ```jsx import React from 'react'; const SubMenuSuffix = () => { return (
{/* Submenu with a suffix element */}
); }; export default SubMenuSuffix; ``` ```jsx import React from 'react'; const SubMenuComponent = () => { return (
{/* Submenu using a custom component */}
); }; export default SubMenuComponent; ``` ```jsx import React from 'react'; const SubMenuContentClassname = () => { return (
{/* Submenu with custom content classname */}
); }; export default SubMenuContentClassname; ``` ```jsx import React from 'react'; const SubMenuOnClick = () => { const handleClick = () => { console.log('Submenu clicked!'); }; return (
{/* Submenu with an onClick handler */}
); }; export default SubMenuOnClick; ``` ```jsx import React, { useState } from 'react'; const SubMenuOnOpenChange = () => { const [isOpen, setIsOpen] = useState(false); const handleOpenChange = (open) => { setIsOpen(open); console.log('Submenu open state changed:', open); }; return (
{/* Submenu with onOpenChange handler */}
); }; export default SubMenuOnOpenChange; ``` ```jsx import React from 'react'; const SubMenuRootStyles = () => { return (
{/* Submenu with custom root styles */}
); }; export default SubMenuRootStyles; ``` -------------------------------- ### Vertical Nav - Basic Configuration Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/menu-examples/vertical-examples/vertical-nav/overlay Demonstrates the basic setup for a vertical navigation menu. This includes essential HTML structure and CSS classes for initial rendering. ```html ``` -------------------------------- ### Vertical Nav Basic Configuration Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/menu-examples/vertical-examples/vertical-nav/basic Demonstrates the basic setup for a vertical navigation menu. This includes essential HTML structure and CSS classes for styling. ```html ``` -------------------------------- ### Apps & Pages Setup Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/theming/create-your-own-theme Instructions for setting up various applications and pages within the Materialize Next.js Admin Template, including initial configuration and structure. ```text To add a new page: 1. Create a new file in the `src/pages/` directory (e.g., `src/pages/dashboard.js`). 2. Define your React component for the page. 3. Ensure proper routing is handled by Next.js. ``` -------------------------------- ### Example API Route Handler (GET) Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/nextjs-api Implements a GET request handler for an example API route. It fetches data from the fake database and returns it as a JSON response using Next.js server components. ```javascript // Next Imports import{ NextResponse }from'next/server' // Data Imports import{ db }from'@/fake-db/**/example' exportasyncfunctionGET(){ return NextResponse.json(db) } ``` -------------------------------- ### Apps and Pages Setup Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/home-page-url Guidance on setting up different applications and pages within the Materialize Next.js Admin Template. This includes understanding the structure for adding new features and views. ```APIDOC Setting up Apps and Pages: 1. **Create a new page file** in the `src/pages/` directory (e.g., `src/pages/dashboards/analytics.js`). 2. **Define the layout** for the page by importing and using a layout component from `src/layouts/`. ```javascript import BlankLayout from 'src/layouts/BlankLayout'; import DashboardLayout from 'src/layouts/DashboardLayout'; const AnalyticsPage = () => { return ( {/* Page content */}

Analytics Dashboard

); }; AnalyticsPage.getLayout = (page) => {page}; // For specific layout assignment export default AnalyticsPage; ``` 3. **Add routing information** if necessary, especially for nested routes or dynamic routes. 4. **Integrate with navigation menus** by updating the navigation configuration files (e.g., `src/navigation/vertical/index.js`). ```javascript // src/navigation/vertical/index.js const verticalNavItems = [ // ... other items { title: 'Dashboards', icon: 'mdi:home-outline', children: [ { title: 'Analytics', path: '/dashboards/analytics' }, // ... other dashboard pages ] } // ... other sections ]; export default verticalNavItems; ``` 5. **Consider authentication and authorization** requirements for the new page. ``` -------------------------------- ### Ticket Title Structure Examples Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/overview/getting-support Examples demonstrating the correct format for support ticket titles, including various ticket types like 'question', 'installation', 'auth', 'acl', 'feat-req', 'bug', and 'other'. ```APIDOC [question] How to change theme? [question] How to change i18n locale? [installation] Errors during npm run dev [auth] Unexpected behavior after login [other] Collapse component not working as expected [auth] Redirected to login page post-login on refresh ``` -------------------------------- ### Troubleshooting: Installation Warnings Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/faqs/installation-errors Explanation of common warnings during the installation process of the Materialize Next.js Admin Template and how to address them. ```bash # Common Installation Warnings: # - Deprecated package versions: Packages might be using older versions. # - Solution: Usually safe to ignore unless they cause issues, or update them cautiously. # - Unused dependencies: Warnings about packages not being used. # - Solution: Can be removed to clean up `package.json`. ``` -------------------------------- ### Configuration: Local Template Setup Like Online Demos Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/faqs/how-to-use-directions Instructions on how to configure the local development environment of the Materialize Next.js Admin Template to match the appearance and functionality of the online demos. ```javascript /* To configure local template like demos: 1. Ensure all demo-specific configurations (e.g., theme settings, initial data) are applied. 2. Check environment variables that might affect demo features. 3. Verify that all necessary assets are correctly loaded. */ ``` -------------------------------- ### Invoice Fake Database Structure Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/apps-and-pages-setup/apps Defines the structure for fake invoice data using TypeScript. This example shows how to export an array of InvoiceType objects, representing mock data for the invoice application. ```typescript import type { InvoiceType } from '@/types/apps/invoiceTypes'; export const db: InvoiceType[] = [ // ...Invoice data... ]; ``` -------------------------------- ### Next.js API Route for Invoice Data Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/apps-and-pages-setup/apps An example of a Next.js API route handler that serves fake invoice data. It uses NextResponse to return a JSON response, importing data from a local fake database. ```javascript import { NextResponse } from 'next/server'; import { db } from '@/app/api/fake-db/apps/invoice'; export async function GET() { return NextResponse.json(db); } ``` -------------------------------- ### Materialize Template Overview Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/overview/getting-started This section outlines the core features and documentation scope of the Materialize Next.js Admin Template. It clarifies that detailed documentation is provided for layouts, menus, custom components, and modifications to Material-UI (MUI) components, while directing users to the official Material-UI documentation for standard MUI components. ```APIDOC Materialize Next.js Admin Template Documentation: Scope: - Layouts - Menus - Custom Components - Material-UI (MUI) component modifications External Resources: - Official Material-UI documentation for standard MUI components. ``` -------------------------------- ### Development: Apps & Pages Setup Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/theming/add-new-custom-color Guidance on setting up different applications and pages within the Materialize Next.js Admin Template. This includes understanding routing and page structure. ```APIDOC Apps & Pages Setup: - **Pages Directory**: The `src/pages` directory contains all your application's pages. Next.js uses file-based routing based on the structure of this directory. - **Layouts**: Different page layouts can be defined in the `src/layouts` directory and applied to specific pages. - **Routing**: Create new pages by adding files to `src/pages`. For example, `src/pages/dashboard.js` will be accessible at `/dashboard`. - **Dynamic Routes**: Use square brackets for dynamic routes, e.g., `src/pages/users/[id].js` will handle routes like `/users/123`. - **Nested Routes**: Create nested routes by creating nested folders within `src/pages`. - **App Configuration**: Specific application configurations might be managed in files within `src/config` or through environment variables. - **Example Page Structure**: - `src/pages/index.js` (Homepage) - `src/pages/dashboard/index.js` (Dashboard) - `src/pages/dashboard/analytics.js` (Dashboard Analytics) - `src/pages/users/[userId].js` (User Profile) ``` -------------------------------- ### Configuration: Local Template to Match Demo Appearance Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/faqs/installation-errors Steps to configure the local installation of the Materialize Next.js Admin Template to match the appearance of the online demos. ```javascript /* To configure local template like demos: 1. Identify the specific demo you want to replicate. 2. Check the template's configuration files (e.g., theme settings, layout configurations) for options related to demo styles. 3. Adjust SCSS variables for colors, fonts, and layout settings to match the demo. 4. Ensure you are using the same component versions and configurations as the demo. */ ``` -------------------------------- ### Basic Table Example Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/user-interface/mui-table Demonstrates a basic Material-UI table with sample data. This serves as a foundational example for creating tables. ```javascript import * as React from 'react'; import Table from '@mui/material/Table'; import TableBody from '@mui/material/TableBody'; import TableCell from '@mui/material/TableCell'; import TableContainer from '@mui/material/TableContainer'; import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; import Paper from '@mui/material/Paper'; function createData(name, calories, fat, carbs, protein) { return { name, calories, fat, carbs, protein }; } const rows = [ createData('Frozen yoghurt', 159, 6, 24, 4), createData('Ice cream sandwich', 237, 9, 37, 4.3), createData('Eclair', 262, 16, 24, 6), createData('Cupcake', 305, 3.7, 67, 4.3), createData('Gingerbread', 356, 16, 49, 3.9), ]; export default function BasicTable() { return ( Dessert (100g serving) Calories Fat (g) Carbs (g) Protein (g) {rows.map((row) => ( {row.name} {row.calories} {row.fat} {row.carbs} {row.protein} ))}
); } ``` -------------------------------- ### Troubleshooting: Installation Errors Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/faqs/installation-errors Common installation errors encountered with the Materialize Next.js Admin Template and their potential solutions. ```bash # Common Installation Errors: # 1. Dependency conflicts: `npm install` or `yarn install` might fail. # - Solution: Try deleting `node_modules` and `package-lock.json` (or `yarn.lock`) and reinstalling. # 2. Node.js version issues: Ensure your Node.js version is compatible. # - Solution: Use a Node version manager (like nvm) to switch to a recommended version. # 3. Build errors: Errors during `npm run build` or `yarn build`. # - Solution: Check the error messages carefully for clues, often related to syntax or missing configurations. ``` -------------------------------- ### Basic List Example Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/user-interface/components/list Demonstrates a simple list structure using Material-UI's List component. This serves as the foundational example for creating lists. ```jsx import React from 'react'; import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import ListItemText from '@mui/material/ListItemText'; function BasicList() { return ( ); } ``` -------------------------------- ### Horizontal Menu Examples Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/menu-examples/horizontal-examples/menu/text-truncate Provides examples and configurations for horizontal menu components within the Materialize Next.js Admin Template. This includes basic setup, popout triggers, transition durations, item styling, offset adjustments, icon configurations, text truncation, and root styling. ```jsx import React from 'react'; // Basic Horizontal Menu Example const BasicHorizontalMenu = () => (
{/* Menu items */}
); // Horizontal Menu with Popout Trigger Example const PopoutTriggerMenu = () => (
{/* Menu items with popout trigger */}
); // Horizontal Menu with Transition Duration Example const TransitionDurationMenu = () => (
{/* Menu items with custom transition duration */}
); // Horizontal Menu with Custom Item Styles Example const MenuItemStylesMenu = () => (
{/* Menu items with custom styles */}
); // Horizontal Menu with Popout Offset Example const PopoutOffsetMenu = () => (
{/* Menu items with adjusted popout offset */}
); // Horizontal Menu with Expand Menu Icon Example const ExpandMenuIconMenu = () => (
{/* Menu items with custom expand icon */}
); // Horizontal Menu with Expanded Menu Item Icon Example const ExpandedMenuItemIconMenu = () => (
{/* Menu items with custom expanded item icon */}
); // Horizontal Menu with Text Truncate Example const TextTruncateMenu = () => (
{/* Menu items with text truncation */}
); // Horizontal Menu with Vertical Menu Props Example const VerticalMenuPropsMenu = () => (
{/* Horizontal menu utilizing vertical menu props */}
); // Horizontal Menu with Root Styles Example const RootStylesMenu = () => (
{/* Horizontal menu with custom root styles */}
); export { BasicHorizontalMenu, PopoutTriggerMenu, TransitionDurationMenu, MenuItemStylesMenu, PopoutOffsetMenu, ExpandMenuIconMenu, ExpandedMenuItemIconMenu, TextTruncateMenu, VerticalMenuPropsMenu, RootStylesMenu }; ``` -------------------------------- ### NextAuth.js Authentication Setup Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/authentication/add-auth This section details how to add authentication to the starter-kit using NextAuth.js. It covers the general process and prerequisites for integrating NextAuth.js. ```APIDOC NextAuth.js Authentication: Purpose: Integrate NextAuth.js for authentication in the starter-kit. Dependencies: NextAuth.js library. Process: 1. Install NextAuth.js: `npm install next-auth` or `yarn add next-auth`. 2. Configure NextAuth.js: Set up `pages/api/auth/[...nextauth].js`. 3. Add authentication providers (e.g., Credentials, Google). 4. Secure pages and API routes as needed. Related: Credentials Provider, Google Provider, Securing Pages. ``` -------------------------------- ### Horizontal Nav Examples Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/menu-examples/horizontal-examples/horizontal-nav Examples demonstrating various configurations and behaviors for horizontal navigation in the Materialize Next.js Admin Template. This includes basic setup, switching to vertical mode, hiding the menu, and handling breakpoints. ```javascript /* Basic Horizontal Navigation Setup This example shows the fundamental structure for a horizontal navigation bar. */ // Component: HorizontalNav // Props: // - items: Array of navigation items // - activeItem: The currently active navigation item /* Switching to Vertical Navigation Demonstrates how to dynamically switch the horizontal navigation to a vertical layout, often triggered by screen size or user preference. */ // Component: HorizontalNav // Props: // - items: Array of navigation items // - activeItem: The currently active navigation item // - isVertical: Boolean to enable vertical layout /* Hiding the Horizontal Menu Example of how to hide the horizontal navigation, potentially for specific views or states. */ // Component: HorizontalNav // Props: // - items: Array of navigation items // - activeItem: The currently active navigation item // - hidden: Boolean to hide the navigation /* Handling Breakpoints for Horizontal Navigation Illustrates how the horizontal navigation adapts to different screen sizes using predefined breakpoints. */ // Component: HorizontalNav // Props: // - items: Array of navigation items // - activeItem: The currently active navigation item // - breakpoint: The screen width at which to switch behavior /* Custom Breakpoint Configuration Allows for defining custom screen widths to trigger responsive changes in the horizontal navigation. */ // Component: HorizontalNav // Props: // - items: Array of navigation items // - activeItem: The currently active navigation item // - customBreakpoint: Object defining custom breakpoint values /* Custom Styles for Horizontal Navigation Provides examples of applying custom styling to the horizontal navigation elements. */ // Component: HorizontalNav // Props: // - items: Array of navigation items // - activeItem: The currently active navigation item // - customStyles: Object or CSS classes for custom styling /* Vertical Nav Props Documentation Details the properties available for configuring the vertical navigation component, which might be used in conjunction with or as an alternative to horizontal navigation. */ // Component: VerticalNav // Props: // - menuData: Data structure for the vertical menu items // - open: Boolean to control the open/closed state of the menu // - theme: String specifying the menu theme // - skin: String specifying the menu skin // - navType: String indicating the type of navigation (e.g., 'compact', 'mini', 'default') // - minimal: Boolean for minimal display mode // - collapsed: Boolean for collapsed state // - mode: String for display mode (e.g., 'vertical', 'horizontal') // - className: Additional CSS classes // - sx: Style object for custom styling // - ... other props for menu items and behavior ``` -------------------------------- ### Example Data Type Definition Source: https://demos.pixinvent.com/materialize-nextjs-admin-template/documentation/docs/guide/development/nextjs-api Defines the TypeScript interface for the example data, ensuring type safety for API data. It specifies the expected types for userId, id, title, and completed properties. ```typescript exporttypeExampleType={ userId:number id:number title:string completed:boolean } ```