How to Create a Sidebar in Next.js & Tailwind CSS
HTML-код
- Опубликовано: 9 май 2022
- In this tutorial, I will be demonstrating how to create a sidebar menu in Next.js and Tailwind CSS for a simple dashboard such as a blog's admin dashboard.
Link to tailwind documentation on how to configure tailwind CSS with Next.js tailwindcss.com/docs/guides/n...
Benefits of using Tailwind CSS
1. It is Highly Customizable: Tailwind CSS is a highly customizable framework. The configuration file enables easy customization of color palettes, styling, spacing, themes, etc.
2. It Has Common Utility Patterns: Eliminate the hassle of naming classes with Tailwind CSS. The availability of common utility patterns solves numerous problems like specifying classes, organizing them, cascading them, and much more. Utility classes simplify the process of creating custom components. You do not need to hard-code with Tailwind CSS. You can apply the theme() function to extract values from the configuration files.
3. It Can Be Optimized Using PurgeCSS: A major advantage of Tailwind CSS is that optimization can be performed using PurgeCSS. PurgeCSS can reduce the file size considerably by scanning the HTML and removing unused classes. It is easy to set up PurgeCSS in combination with Tailwind CSS and is highly recommended to do so before deploying the site. As the size of the project grows, the size of the CSS file also increases. However, this does not happen when using Tailwind. The use of a standardized set of classes keeps the file size small as long as the project remains active.
4. It Enables Building Complex Responsive Layouts Freely: The Tailwind CSS framework uses a default mobile-first approach.
5. It Facilitates Fluid Community Interaction
Source code: github.com/dieudonneAwa/blog-...
Check OUT other React tutorials:
▶️ • React Tutorials
_______________________________________
SOURCE CODE:
github.com/dieudonneAwa/blog-...
___________________________________________
🙏 PLEASE SUBSCRIBE FOR MORE VIDEOS 👇
bit.ly/3cIb4er
____________________________________________
🔮OTHER VIDEOS YOU MIGHT LIKE👇👇
▶️ How to create React App from Scratch: • How to setup React app...
▶️Create Sequelize Migration and Association: • Create Sequelize Migra...
▶️How to create an animated modal in reactjs: • How to create a nicely...
▶️ How to render a list of todo objects in Reactjs: • Render a list of task ...
▶️How to setup sequelize and postgres: • How to setup Sequelize...
▶️Password Reset using SendGrid: • Password Reset using S...
▶️ CRUD Operations with sequelize: • CRUD operations with S...
____________________________________________
HELPFUL RESOURCES
Certified ScrumMaster Training: Get $200 off Today! Use this code SCRUM200
click.linksynergy.com/fs-bin/...
$2,760 in Savings: Premium PMP Exam Prep Boot Camp! Get everything you need to pass & enhance your skills
click.linksynergy.com/fs-bin/...
Follow me on Social Media:
Facebook: profile.php?...
Twitter: awadieudone?s=09
GitHub: github.com/dieudonneAwa
Personal Blog: awadieudonne.com/
KEYWORDS
Create a sidebar in Next.js, Next.js sidebar, Tailwind CSS sidebar, Next.js and Tailwind CSS, Sidebar layout in Next.js, Next.js and Tailwind CSS tutorial, Adding a sidebar in Next.js, Styling sidebar with Tailwind CSS, Next.js sidebar tutorial, Next.js and Tailwind CSS sidebar, Next.js and Tailwind CSS navigation, Next.js sidebar navigation, Tailwind CSS and Next.js sidebar, Creating sidebar in Next.js and Tailwind CSS, Next.js and Tailwind CSS: A complete guide to create a sidebar, How to implement sidebar in Next.js using Tailwind CSS, Next.js and Tailwind CSS for sidebar, Next.js Tailwind CSS sidebar, Next.js and Tailwind CSS: A step by step guide to create a sidebar. - Наука
This is really good dude; one question, if the content section have long which needs vertical scrolling will the sidebar stay fixed?
thank you for the education
Hi, thank you, this has clarified a few things for me. My only concern with your navbar is that you are duplicating it. With a simple trick, I was able to toggle the nav function to modify CSS using just one menu - this is much easier to maintain (unless one would want different items displayed in each).
Just what I needed thanks a ton.
You’re welcome. Please don’t forget to subscribe.
@@fullstackmastery Subscribed!
@@strangelight159 thanks
Great tutorial man
Thanks Kunal. ☺
Very nice design, on thing i doubt that when i change the route manually will the active tab change, if not how can I do so
When im console.log(activeMenu) i got notice like this undefined, how to fix this?
How do you add a dropdown to the side bar?
Does this page work on server side rendering
Hi, kindly help me on adding submenu on your code, thanks
13:25 Sidebar Tailwind CSS Properties
["bg-light-lighter"]: activeMenu.id === menu.id, , how to fix this?
nice
This is helpful, how about a full layout, responsive like this but with a header and a footer.
Thanks for watching Juliet. Please remember to subscribe. I will be uploading more helpful videos in the coming weeks.
Error: Failed prop type: The prop `href` expects a `string` or `object` in ``, but got `undefined` instead.
Open your browser's console to view the Component stack trace.
Can i get some help please?
Did you import Link from next?
How do I make the sidebar static and not affect the content, thanks for the video, I hope a prompt response
Tough luck, buddy.
Great video. Constructive criticism: the audio quality is so poor it makes watching the video unpleasant.
Server Error
TypeError: Cannot read properties of undefined (reading 'id') - ["bg-light-lighter"]: activeMenu.id === menu.id, help
You need to make sure activeMenu and menu are defined
Were you able to solve it?@@fullstackmastery
Nice tutorial, thank you. I wanted to point out a problem: the logout menu item is not part of activeMenu. If you add a Link to the logout menu item, it will trigger the useMenu, which will fail because the logout router path is not in activeMenu. You cannot add logout to activeMenu unless you add special treatment for the positioning at the bottom of the page. A hack to work around this is to create a memoItems list which includes logout in the array and pass that to useMemo. What is a better way to deal with this?
Logout is supposed to log you out of that dashboard, meaning you should be taken out of the dashboard to a different page for instance, the login page
TypeError: Cannot read properties of undefined (reading 'id') how to fix this?
make sure your menu array is initialized before the menuIcons function. For me, my issue was that I did "const router = useRouter" instead of "const router = useRouter();"
help me please
I just can't get that shit to not cover content. CSS sucks so bad I just can't
Nvm, got it. CSS still sucks tho.