,

Creating a React Portfolio with Tailwind CSS, Dark Mode, and Vite.js

Posted by






React Portfolio with Tailwind CSS – Dark Mode & Vite.js

React Portfolio with Tailwind CSS – Dark Mode & Vite.js

Building a personal portfolio website is crucial for showcasing your skills and accomplishments as a developer. In this article, we will explore how to create a React portfolio using Tailwind CSS for styling, with the added feature of dark mode. Additionally, we will use Vite.js as a build tool for a faster development experience.

Setting up the project

First, make sure you have Node.js installed on your machine. Then, create a new React project using create-react-app or your preferred method. Navigate to the project directory and install Tailwind CSS and Vite.js by running the following commands:


npm install tailwindcss
npx tailwindcss init
npm install --save-dev vite

Once the installations are complete, open your index.css file and include the Tailwind CSS styles using the @import directive. Your index.css file should look like this:


@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';

Creating the portfolio components

Now, you can start creating the necessary components for your portfolio. Use the HTML structure and React components to represent different sections of your portfolio such as header, about, projects, and contact.

Utilize Tailwind CSS classes to style your components and make them visually appealing. Explore the documentation to learn about various utilities like grids, spacing, typography, and more.

Implementing dark mode

Dark mode is a popular feature that enhances the user experience and reduces eye strain. To implement dark mode in your portfolio, add a button or a toggle switch that allows users to switch between light and dark modes.

Use JavaScript to toggle a dark mode class on your root element based on the user’s preference. This class can override the default color scheme set by Tailwind CSS, giving your portfolio a dark theme.

Building and deploying the portfolio

Once you have finished designing and implementing your portfolio, it’s time to build and deploy it. Vite.js makes this process seamless and fast. Run the command npm run build to generate the production-ready build of your portfolio.

You can deploy your portfolio to popular hosting platforms like Netlify, Vercel, or GitHub Pages, or choose any other hosting provider of your choice. Ensure that you configure the deployment settings properly to serve the built files correctly.

Conclusion

Creating a React portfolio with Tailwind CSS, dark mode, and Vite.js can elevate your personal branding and showcase your skills effectively. Play around with different layouts, color schemes, and animations to make your portfolio unique and visually appealing. Remember to optimize your portfolio for performance and accessibility to provide a seamless experience to your visitors. Happy coding!


0 0 votes
Article Rating
20 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
WEB CIFAR
1 year ago

🔔subscribe and turn on the notification bell.

👉 Hire Us : https://webcifar.com

👉 Facebook group : https://facebook.com/groups/webcifar

👉 Instagram : https://www.instagram.com/web_cifar/

R G
R G
1 year ago

Is anyone able to explain the id&&id logic

Juan Almonte
1 year ago

I wonder how you could implement the dark mode this way: easy to follow and global throughout the entire application!

StfuSiriusly
1 year ago

are you using vim motions? which plugin are you using

Joshua Rafael Betco
1 year ago

Great

Ahmet Yilmaz
1 year ago

amazing tutorial , i learned how to use tailwindcss + vite.js from this 🙂

Razib Ahmed
1 year ago

your set up is beauty. May i use this set up for others portfolio project

Razib Ahmed
1 year ago

wow great job Sir

SAurav
1 year ago

Thank you man.

Максим Борович
1 year ago

Thank you man! Read few tutorials on how to make dark mode with React, only yours seems to work correctly!

Hyggedev
1 year ago

Great darkmode guide. I tried to make mine as simple as possible. Yours is pretty damn simple 😀 Minus the local storage, but that's easy. Great job. +1

Shreyas
1 year ago

Bro but after refreshing the page it get back to light mode ie. OS mode how to fix keep same mode after refreshing..
I loved your projects 😍😍

Skarsburning
1 year ago

Finally a useful way to make Dark Mode!!! Thank you

GEEK CODE
1 year ago

Great Video M. Arfan. I appreciate a lot your work. keep the great work 👏👏👏 Will follow your good content ✍✌🖐

fardhan mauladi
1 year ago

If i want to import image with local assets not from url, what is the code js that can call the image? Thank you

Muthukumar K
1 year ago

Why vite used??

Theeu
1 year ago

Thank you my friend. It's so easy to css with tailwind. I dont have to mind what is the line there's overwritting my code '-'… anyway subbed and getting all notifications from you.

A humble question: what do we deploy? The files in /src or the compilled in /dist? thank you.

Sayam Rahman Robin
1 year ago

Excellent Excellent

Juno
1 year ago

Excellent tutorial! One question, when I view this website on IOS the font is completely different. Is there anyway to keep the same font across all platforms?

Edit: I figured it out, just needed to import the google font into the css file and change the default sans to inter in the tailwind config file.

Jobaer Ahamed Robin
1 year ago

Hi, What is that terminal prompt/theme at https://youtu.be/QTY2fLpQn44?t=124? Looks clean.