The following process will be used to install admin dashboard using package manager.
composer install
.env
file from copying .env.example
php artisan key:generate
npm install
npm run dev
to start vite development.npm run build
to build for production.php artisan serve
to start php server which will run laravel or if you are using other server apps like WAMP, XAMPP or MAMP, you can follow that guide. In case if you have any problems or query then please contact us
The arrangement below describes our file structure.
This section will give you a brief description of our code.
1. Header Section : This is the default navbar section. It contains :
Note:- These categories are defined by us and you can modify as per your needs :)
<!-- Navbar Component --> <Header></Header> ========================================================== <!-- BEGIN NAVBAR --> <header className={themeConfig.semidark && themeConfig.menu === 'horizontal' ? 'dark' : ''}> <div className="shadow-sm"> <div className="relative flex w-full items-center bg-white px-5 py-2.5 dark:bg-[#0e1726]"> .............................. </div> <!-- horizontal menu --> <ul className="horizontal-menu hidden border-t border-[#ebedf2] bg-white py-1.5 px-6 font-semibold text-black rtl:space-x-reverse dark:border-[#191e3a] dark:bg-[#0e1726] dark:text-white-dark lg:space-x-1.5 xl:space-x-8" > .............................. </ul> </div> </header> <!-- END NAVBAR -->
2. Main Container Section : The main container section includes header, footer and main content section.
<!-- BEGIN MAIN CONTAINER --> <div className={`${(store.getState().themeConfig.sidebar && 'toggle-sidebar') || ''} ${themeConfig.menu} ${themeConfig.layout} ${ themeConfig.rtlClass } main-section antialiased relative font-nunito text-sm font-normal`} > .............................. </div> <!-- END MAIN CONTAINER -->
3. Sidebar : This is the sidebar code.
<!-- Sidebar Component --> <Sidebar></Sidebar> ========================================================== <!-- BEGIN SIDEBAR --> <div className={semidark ? 'dark' : ''}> <nav className={`sidebar fixed min-h-screen h-full top-0 bottom-0 w-[260px] shadow-[5px_0_25px_0_rgba(94,92,154,0.1)] z-50 transition-all duration-300 ${semidark ? 'text-white-dark' : ''}`} > .............................. </nav> </div> <!-- END SIDEBAR -->
4. Main Content : This is the Main Content code section.
This is the root structure where you can create widgets, charts, tables etc.
<!-- BEGIN CONTENT PART --> <div className="main-content"> .............................. </div> <!-- END CONTENT PART -->
5. Footer : This is the Footer code.
<!-- Footer Component --> <Footer></Footer> ========================================================== <!-- BEGIN FOOTER --> <p className="pt-6 text-center dark:text-white-dark ltr:sm:text-left rtl:sm:text-right"> .............................. </p> <!-- END FOOTER -->
Now, after a brief description of our admin template. Below is the combined code of the snippets we have discuss above.
<!-- BEGIN MAIN CONTAINER --> <div className="main-section antialiased relative font-nunito text-sm font-normal" :className="[store.sidebar ? 'toggle-sidebar' : '', store.menu, store.layout, store.rtlClass]"> <!-- BEGIN SIDEBAR MENU OVERLAY --> <div className={`${(!themeConfig.sidebar && 'hidden') || ''} fixed inset-0 bg-[black]/60 z-50 lg:hidden`} onClick={() => dispatch(toggleSidebar())}></div> <!-- END SIDEBAR MENU OVERLAY --> <!-- BEGIN SCREEN LOADER --> {showLoader && ( <div className="screen_loader fixed inset-0 bg-[#fafafa] dark:bg-[#060818] z-[60] grid place-content-center animate__animated"> <svg>...</svg> </div> )} <!-- END SCREEN LOADER --> <!-- BEGIN SCROLL TO TOP BUTTON --> <div className="fixed bottom-6 ltr:right-6 rtl:left-6 z-50"> {showTopButton && ( <button type="button" className="btn btn-outline-primary animate-pulse rounded-full bg-[#fafafa] p-2 dark:bg-[#060818] dark:hover:bg-primary" @click="goToTop"> <svg>...</svg> </button> )} </div> <!-- END SCROLL TO TOP BUTTON --> <!-- BEGIN APP SETTING LAUNCHER --> <Setting /> <!-- END APP SETTING LAUNCHER --> <div className={`${themeConfig.navbar} main-container text-black dark:text-white-dark min-h-screen`}> <!-- BEGIN SIDEBAR --> <Sidebar /> <!-- END SIDEBAR --> <!-- BEGIN CONTENT AREA --> <div className="main-content"> <!-- BEGIN NAVBAR --> <Header /> <!-- END NAVBAR --> <Suspense> <div className={`${themeConfig.animation} p-6 animate__animated`}> <!-- BEGIN PAGE CONTENT --> {children} <!-- BEGIN FOOTER --> <Footer /> <!-- END FOOTER --> </div> </Suspense> <!-- END PAGE CONTENT --> </div> <!-- END CONTENT AREA --> </div> </div> <!-- END MAIN CONTAINER -->
This section will give you a brief description of our admin template JS code.
1. app-setting.js : This is primary js file. It is necessary for the layout to work. It contains the code as follows :-
import { PropsWithChildren, useEffect } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { IRootState } from './store'; import { toggleRTL, toggleTheme, toggleLocale, toggleMenu, toggleLayout, toggleAnimation, toggleNavbar, toggleSemidark } from './store/themeConfigSlice'; import store from './store'; function App({ children }: PropsWithChildren) { const themeConfig = useSelector((state: IRootState) => state.themeConfig); const dispatch = useDispatch(); useEffect(() => { dispatch(toggleTheme(localStorage.getItem('theme') || themeConfig.theme)); dispatch(toggleMenu(localStorage.getItem('menu') || themeConfig.menu)); dispatch(toggleLayout(localStorage.getItem('layout') || themeConfig.layout)); dispatch(toggleRTL(localStorage.getItem('rtlClass') || themeConfig.rtlClass)); dispatch(toggleAnimation(localStorage.getItem('animation') || themeConfig.animation)); dispatch(toggleNavbar(localStorage.getItem('navbar') || themeConfig.navbar)); dispatch(toggleLocale(localStorage.getItem('i18nextLng') || themeConfig.locale)); dispatch(toggleSemidark(localStorage.getItem('semidark') || themeConfig.semidark)); }, [dispatch, themeConfig.rtlClass, themeConfig.theme, themeConfig.locale, themeConfig.menu, themeConfig.layout, themeConfig.animation, themeConfig.navbar, themeConfig.semidark]); return ( <div className={`${(store.getState().themeConfig.sidebar && 'toggle-sidebar') || ''} ${themeConfig.menu} ${themeConfig.layout} ${ themeConfig.rtlClass } main-section antialiased relative font-nunito text-sm font-normal`} > {children} </div> ); } export default App;
2. theme.config.js : This is theme configuration js file. This file contains optional setting for set defaut layout, theme and language functionality. It contains the code as follows :-
// APP CONFIG export const $themeConfig = { locale: 'en', // en, da, de, el, es, fr, hu, it, ja, pl, pt, ru, sv, tr, zh theme: 'light', // light, dark, system menu: 'vertical', // vertical, collapsible-vertical, horizontal layout: 'full', // full, boxed-layout rtlClass: 'ltr', // rtl, ltr animation: '', // animate__fadeIn, animate__fadeInDown, animate__fadeInUp, animate__fadeInLeft, animate__fadeInRight, animate__slideInDown, animate__slideInLeft, animate__slideInRight, animate__zoomIn navbar: 'navbar-sticky', // navbar-sticky, navbar-floating, navbar-static semidark: false, };