Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • React Tutorial
  • React Exercise
  • React Basic Concepts
  • React Components
  • React Props
  • React Hooks
  • React Router
  • React Advanced
  • React Examples
  • React Interview Questions
  • React Projects
  • Next.js Tutorial
  • React Bootstrap
  • React Material UI
  • React Ant Design
  • React Desktop
  • React Rebass
  • React Blueprint
  • JavaScript
  • Web Technology
Open In App
Next Article:
Create FAQs using React and Tailwind CSS
Next article icon

Create Feeds UI using React and Tailwind CSS

Last Updated : 26 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

In the world of social networking, feeds are the primary way users interact with content. Whether it is on LinkedIn, Facebook, or Twitter the feed showcases posts updates, and activities from people or organizations. This article will help you build a LinkedIn-style feed UI using React and Tailwind CSS.

Prerequisites

  • React
  • Tailwind CSS
  • React Icons
  • Node.js

Steps to Create Feeds UI using React and Tailwind CSS

Step 1: Set up the project using the command.

npx create-react-app react-app
cd react-app

Step 2: Install Tailwind CSS using the command.

npm install -D tailwindcss postcss autoprefixer 
npx tailwindcss init -p

Step 3: Configure the tailwind paths in your tailwind.config.js file.

module.exports = {
content: ["./src/**/*.{js,jsx,ts,tsx}"],
theme: {
extend: {
colors: {
primaryGreen: "#4CAF50", // Green
primaryBlack: "#000000", // Black
primaryWhite: "#FFFFFF", // White
}
},
},
plugins: [],
}

Step 4: Add tailwind directives to your index.css file.

@tailwind base;
@tailwind components;
@tailwind utilities;

body {

margin: 0;
font-family: 'Times New Roman', Times, serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

h2 {
margin-top: 2rem;
/* Adjust top margin for spacing */
}

Project Structure

Screenshot-2024-09-12-114329
project structure

Updated dependencies

"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "^5.3.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
}

Example: This example demonstrates the creation of Feeds U using React and Tailwind CSS

JavaScript
// App.js  import React from 'react'; import { FaThumbsUp, FaHeart, FaShare, FaCommentAlt } from 'react-icons/fa';  function App() {     // Dummy profile section data     const userProfile = {         name: "John Doe",         title: "Software Engineer",         avatar: "https://via.placeholder.com/100",     };      // Dummy posts data     const posts = [         { id: 1, user: { name: "Jane Smith",          avatar: "https://via.placeholder.com/50" },          content: "Excited to work on my new project!", time: "2 hours ago" },         { id: 2, user: { name: "Mike Johnson",          avatar: "https://via.placeholder.com/50" },          content: "Just finished a 10K run!", time: "4 hours ago" },         { id: 3, user: { name: "Alex Brown", avatar:          "https://via.placeholder.com/50" }, content:          "Attending a React conference today.", time: "5 hours ago" },         { id: 4, user: { name: "Emma Wilson", avatar:          "https://via.placeholder.com/50" }, content:          "Learning new JavaScript features.", time: "7 hours ago" },         { id: 5, user: { name: "Liam Davis", avatar:          "https://via.placeholder.com/50" }, content:          "Networking at the web dev meetup.", time: "8 hours ago" },         { id: 6, user: { name: "Olivia Martinez", avatar:          "https://via.placeholder.com/50" }, content: "Just published         a new blog post!", time: "10 hours ago" },         { id: 7, user: { name: "Sophia Anderson", avatar:          "https://via.placeholder.com/50" }, content:          "Developing a React Native app.", time: "12 hours ago" },         { id: 8, user: { name: "Jackson White", avatar:          "https://via.placeholder.com/50" }, content: "Starting          a new open-source project.", time: "14 hours ago" },         { id: 9, user: { name: "Isabella Green", avatar:          "https://via.placeholder.com/50" }, content:          "Collaborating with a new team.", time: "16 hours ago" },         { id: 10, user: { name: "Mason Thompson", avatar:          "https://via.placeholder.com/50" }, content: "Exploring GraphQL         and Apollo.", time: "18 hours ago" },     ];      return (         <div className="bg-primaryWhite min-h-screen p-5">             <div className="max-w-3xl mx-auto">                 {/* Profile Section */}                 <div className="bg-primaryGreen p-4 rounded-lg shadow-md mb-6                  flex items-center">                     <img src={userProfile.avatar} alt="Profile"                      className="w-24 h-24 rounded-full" />                     <div className="ml-4">                         <h2 className="text-2xl font-bold text-primaryWhite">                         {userProfile.name}</h2>                         <p className="text-primaryWhite">{userProfile.title}</p>                     </div>                 </div>                  {/* Feed Section */}                 <div className="space-y-6">                     {posts.map(post => (                         <div key={post.id} className="bg-white p-4 rounded-lg shadow-md">                             <div className="flex items-center mb-3">                                 <img src={post.user.avatar} alt="avatar"                                  className="w-12 h-12 rounded-full" />                                 <div className="ml-3">                                     <h2 className="font-bold text-                                     lg text-primaryBlack">{post.user.name}</h2>                                     <p className="text-sm text-gray-500">{post.time}</p>                                 </div>                             </div>                             <p className="text-gray-700 mb-3">{post.content}</p>                             <div className="flex justify-around text-gray-500">                                 <button className="flex items-center space-x-1                                 hover:text-primaryGreen">                                     <FaThumbsUp className="text-primaryGreen" />                                     <span>Like</span>                                 </button>                                 <button className="flex items-center space-x-1                                  hover:text-red-500">                                     <FaHeart className="text-red-500" />                                      <span>Love</span>                                 </button>                                 <button className="flex items-center space-x-1                                 hover:text-blue-500">                                     <FaShare className="text-blue-500" />                                     <span>Share</span>                                 </button>                                 <button className="flex items-center space-x-1                                 hover:text-gray-600">                                     <FaCommentAlt className="text-gray-600" />                                      <span>Comment</span>                                 </button>                             </div>                         </div>                     ))}                 </div>             </div>         </div>     ); }  export default App; 


To start the Application run the following command.

npm start

Output:


Next Article
Create FAQs using React and Tailwind CSS

M

myarticp87y
Improve
Article Tags :
  • Web Technologies
  • ReactJS
  • Tailwind CSS

Similar Reads

  • Create FAQs using React and Tailwind CSS
    A Frequently Asked Questions section is a common feature found on websites and applications that helps users find answers to common queries in an organized manner. A well-designed FAQ can improve user experience reduce support requests and provide users with quick and easy access to helpful informat
    5 min read
  • Create Footers Using React And Tailwind CSS
    We will learn how to create a responsive footer using React and Tailwind CSS with a modern design. The footer will feature a green background with white text providing a clean and professional look. We will create three sections: Contacts social media and Services to display important information an
    3 min read
  • Create Navbars UI using React and Tailwind CSS
    A UI plays an important role because a clean, well-designed interface creates a positive first impression and if the UI is good then users can stay on our website some more time and if the UI is bad then they can not stay on our site for more time. we will see how to Create Navbars UI using React an
    5 min read
  • Create Dropdowns UI using React and Tailwind CSS
    Dropdown UI components are often used in web applications for forms, navigation, or user preferences, allow users to select from a list of options by clicking a button, which will display a drop-down menu, in this article we will create a dropdown element using React for functionality and Tailwind C
    3 min read
  • Create Header using React and Tailwind CSS
    In modern web development building responsive and customizable user interfaces is crucial. One of the essential elements of any web application is the header which typically contains navigation links branding or other important controls. we will create a responsive header section using React and Tai
    4 min read
  • Create Incentives using React and Tailwind CSS
    Creating an Incentives section in a web application can be a great way to highlight special offers and rewards or bonuses that motivate users to engage with your product or service. This feature can be used in various scenarios such as e-commerce websites educational platforms or company portals. In
    4 min read
  • Create Select Menus UI using React and Tailwind CSS
    We will build a Select Menu UI using React and Tailwind CSS. Select menus are dropdowns that allow users to choose one option from a predefined list. We'll style the dropdown using Tailwind CSS for a modern, clean look and integrate React Icons to improve user experience. PrerequisitesReact.jsTailwi
    5 min read
  • Create Command Palettes UI using React and Tailwind CSS
    This article shows you how to create a Command Palette UI using React and Tailwind CSS. A command palette lets users easily search for and run commands within an app, making navigation faster and more efficient. We’ll walk you through building a simple and intuitive interface where users can type, s
    4 min read
  • Create Flyout Menus using React and Tailwind CSS
    Flyout menus are a type of navigational menu that can be displayed when the user hovers over or clicks on an item allowing for a clean and organized display of additional options without crowding the main interface. In this article, we will create a responsive flyout menu using React and Tailwind CS
    4 min read
  • Create Modal Dialogs UI using React and Tailwind CSS
    Modal dialogs are an essential part of modern web applications. They offer a user-friendly way to present information or collect input without navigating away from the current page. Modals typically appear as overlays which help focus the user's attention on specific tasks like forms or alerts and c
    6 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences