### 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