<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Hitesh Chauhan - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Hitesh Chauhan - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sun, 24 May 2026 22:23:53 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/author/hiteshchauhan2023/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Use the tailwind-sidebar NPM Package in Your React and Next.js Apps ]]>
                </title>
                <description>
                    <![CDATA[ These days, developers are increasingly preferring utility-first CSS frameworks like Tailwind CSS to help them build fast, scalable, and highly customizable user interfaces. In this article, you’ll learn what the tailwind-sidebar NPM package is, how ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-use-tailwind-sidebar-npm-package-in-react-nextjs/</link>
                <guid isPermaLink="false">6967d8278e420016a8b8a729</guid>
                
                    <category>
                        <![CDATA[ Tailwind sidebar ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Tailwind CSS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ npm packages ]]>
                    </category>
                
                    <category>
                        <![CDATA[ React ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Next.js ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Frontend Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Hitesh Chauhan ]]>
                </dc:creator>
                <pubDate>Wed, 14 Jan 2026 17:53:43 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1768413200090/f31cbba6-9b9e-4719-bc07-13fe98049d52.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>These days, developers are increasingly preferring utility-first CSS frameworks like Tailwind CSS to help them build fast, scalable, and highly customizable user interfaces.</p>
<p>In this article, you’ll learn what the <code>tailwind-sidebar</code> NPM package is, how it works internally, and how to install and configure it in a real project. We’ll walk through setting up a responsive sidebar using Tailwind CSS, explore its key features with practical examples, and see how you can customize and control the sidebar behavior to fit different layouts and screen sizes.</p>
<p>If you’re building a React or Next.js application and want a lightweight yet powerful sidebar solution, <a target="_blank" href="https://www.npmjs.com/package/tailwind-sidebar"><strong>tailwind-sidebar</strong></a> is an excellent choice.</p>
<h2 id="heading-table-of-contents"><strong>Table of Contents</strong></h2>
<ul>
<li><p><a class="post-section-overview" href="#heading-prerequisites">Prerequisites</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-introduction-to-the-tailwind-sidebar-npm-package">Introduction to the tailwind-sidebar NPM Package</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-why-choose-tailwind-sidebar">Why Choose Tailwind Sidebar?</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-get-started-with-tailwind-sidebar">How to Get Started with Tailwind Sidebar</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-features-of-tailwind-sidebar">Features of Tailwind Sidebar:</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-wrapping-up">Wrapping Up</a></p>
</li>
</ul>
<h2 id="heading-prerequisites"><strong>Prerequisites</strong></h2>
<ul>
<li><p>Basic knowledge of JavaScript (ES6+)</p>
</li>
<li><p>Familiarity with React fundamentals (components, props, JSX)</p>
</li>
<li><p>Basic understanding of Next.js project structure and routing</p>
</li>
<li><p>Experience using npm or yarn for package installation</p>
</li>
<li><p>Working knowledge of Tailwind CSS</p>
</li>
</ul>
<h2 id="heading-introduction-to-the-tailwind-sidebar-npm-package">Introduction to the tailwind-sidebar NPM Package</h2>
<p>The tailwind-sidebar NPM package is a modern, developer-friendly sidebar component that’s built entirely with Tailwind CSS. It’s designed to help developers create responsive, customizable, and accessible sidebars without the overhead of heavy UI frameworks.</p>
<h3 id="heading-understanding-tailwind-sidebar">Understanding Tailwind Sidebar</h3>
<p><code>tailwind-sidebar</code> is a lightweight utility package designed to simplify building responsive sidebars using Tailwind CSS. Instead of manually handling sidebar state, transitions, and responsive behavior, the package provides a small JavaScript layer that works alongside Tailwind’s utility classes.</p>
<p>At its core, the package toggles Tailwind classes to control whether the sidebar is open or closed. This makes it framework-agnostic - it works with plain HTML, as well as frameworks like React, Vue, or Next.js, as long as Tailwind CSS is available.</p>
<p>Because it relies on Tailwind utilities rather than custom CSS, the sidebar stays easy to customize, extend, and maintain.</p>
<h3 id="heading-what-is-tailwind-css">What is Tailwind CSS?</h3>
<p>Tailwind CSS is a utility-first CSS framework that lets you build modern, responsive user interfaces directly in your markup. Instead of predefined components, Tailwind provides low-level utility classes that give you full design control without leaving your HTML.</p>
<p>Tailwind Sidebar is built on top of Tailwind CSS, offering a clean, flexible, and highly customizable sidebar solution for modern web applications.</p>
<h2 id="heading-why-choose-tailwind-sidebar">Why Choose Tailwind Sidebar?</h2>
<h3 id="heading-optimized-performance">Optimized Performance</h3>
<p>Tailwind Sidebar relies on utility classes instead of heavy JavaScript logic. This means that it delivers fast load times and smooth interactions, and is ideal for performance-critical applications.</p>
<h3 id="heading-developer-friendly">Developer-Friendly</h3>
<p>It doesn’t have any complex configuration or component APIs. If you know Tailwind CSS, you already know how to customize the sidebar.</p>
<h3 id="heading-easy-maintenance">Easy Maintenance</h3>
<p>With a simple and predictable structure, updates and custom changes are straightforward, making it suitable for both small projects and large-scale applications.</p>
<h3 id="heading-growing-tailwind-community">Growing Tailwind Community</h3>
<p>Tailwind CSS has a massive and active community. This means better tooling, regular updates, and a wealth of learning resources to support your development workflow.</p>
<h2 id="heading-how-to-get-started-with-tailwind-sidebar">How to Get Started with Tailwind Sidebar</h2>
<p>This section will walk you through installing and setting up <code>tailwind-sidebar</code> in a React and Next.js application. You’ll learn how to add a sidebar, create menus, add a logo, and customize navigation.</p>
<h3 id="heading-step-1-install-tailwind-sidebar">Step 1: Install tailwind-sidebar</h3>
<p>To begin, you’ll need to install <a target="_blank" href="https://www.npmjs.com/package/tailwind-sidebar">tailwind Sidebar</a> into your React and Next.js project. You can do this using either npm or yarn.</p>
<h4 id="heading-using-npm">Using npm:</h4>
<pre><code class="lang-javascript">npm i tailwind-sidebar
</code></pre>
<h4 id="heading-using-yarn">Using yarn:</h4>
<pre><code class="lang-javascript">yarn add tailwind-sidebar
</code></pre>
<p>This will add <code>tailwind-sidebar</code> and its dependencies to your project.</p>
<h3 id="heading-step-2-import-the-tailwind-sidebar-component">Step 2: Import the Tailwind Sidebar Component</h3>
<p>Once the package is installed, you can import the necessary components from tailwind-sidebar into your project. These components will allow you to customize the sidebar with menus, submenus, and even a logo.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> {

  AMSidebar,

  AMMenuItem,

  AMMenu,

  AMSubmenu,

  AMLogo,

} <span class="hljs-keyword">from</span> <span class="hljs-string">"tailwind-sidebar"</span>;
</code></pre>
<h4 id="heading-adding-styles-to-tailwind-sidebar">Adding Styles to Tailwind Sidebar</h4>
<p>To use the default styles of tailwind-sidebar, you need to import its CSS file at the top of your project:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> <span class="hljs-string">"tailwind-sidebar/styles.css"</span>;
</code></pre>
<h3 id="heading-step-3-routing-setup-for-react-and-nextjs">Step 3: Routing Setup for React and Next.Js</h3>
<p>To enable navigation inside <code>tailwind-sidebar</code> components like <code>AMMenuItem</code> or <code>AMLogo</code>, you need to pass a link component from either react-router or next/link using the component prop inside the corresponding component, like what’s shown in the below example:</p>
<p>If you're using <strong>React</strong>:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { Link } <span class="hljs-keyword">from</span> <span class="hljs-string">"react-router-dom"</span>;

<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">AMSidebar</span> <span class="hljs-attr">width</span>=<span class="hljs-string">{</span>"<span class="hljs-attr">270px</span>"}&gt;</span>

     <span class="hljs-tag">&lt;<span class="hljs-name">AMLogo</span> <span class="hljs-attr">img</span>=<span class="hljs-string">"https://adminmart.com/wp-content/uploads/2024/03/logo-admin-mart-news.png"</span>
        <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span>
        <span class="hljs-attr">href</span>=<span class="hljs-string">"/"</span>
      &gt;</span>
        Adminmart

      <span class="hljs-tag">&lt;/<span class="hljs-name">AMLogo</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">AMMenu</span> <span class="hljs-attr">subHeading</span>=<span class="hljs-string">"HOME"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span>
         <span class="hljs-attr">icon</span>=<span class="hljs-string">{</span>&lt;<span class="hljs-attr">Home</span> /&gt;</span>}
          link="/"  // Passing link to component for routing
          badge={true}
          badgeType="default"
          badgeColor={"bg-secondary"}
          isSelected={true}
        &gt;
          {/* text for your link */}
          Link Text
        <span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">AMMenu</span>&gt;</span>
   <span class="hljs-tag">&lt;/<span class="hljs-name">AMSidebar</span>&gt;</span></span>
</code></pre>
<p>And if you're using <strong>Next.js</strong>:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span>  Link  <span class="hljs-keyword">from</span> <span class="hljs-string">"next/link"</span>;<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">AMSidebar</span> <span class="hljs-attr">width</span>=<span class="hljs-string">{</span>"<span class="hljs-attr">270px</span>"}&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">AMLogo</span> <span class="hljs-attr">img</span>=<span class="hljs-string">"https://adminmart.com/wp-content/uploads/2024/03/logo-admin-mart-news.png"</span>
        <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span> // <span class="hljs-attr">Passing</span> <span class="hljs-attr">link</span> <span class="hljs-attr">to</span> <span class="hljs-attr">component</span> <span class="hljs-attr">for</span> <span class="hljs-attr">routing</span>
        <span class="hljs-attr">href</span>=<span class="hljs-string">"/"</span>
      &gt;</span>
        Adminmart
      <span class="hljs-tag">&lt;/<span class="hljs-name">AMLogo</span>&gt;</span>
        AdminMart
      <span class="hljs-tag">&lt;/<span class="hljs-name">Logo</span>&gt;</span></span>
      <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">AMMenu</span> <span class="hljs-attr">subHeading</span>=<span class="hljs-string">"HOME"</span>&gt;</span>
         <span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span>
          <span class="hljs-attr">icon</span>=<span class="hljs-string">{</span>&lt;<span class="hljs-attr">Home</span> /&gt;</span>}
          link="/tes"
          component={Link}
          isSelected={true}
        &gt;
           Link Text {/* text for your link */}
        <span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">AMMenu</span>&gt;</span></span>
    &lt;/AMSidebar&gt;
</code></pre>
<h3 id="heading-step-4-initializing-the-sidebar">Step 4: Initializing the Sidebar</h3>
<p>Now we’ll set up the <code>AMSidebar</code> component in your application. You can set the width of the sidebar using the <code>width</code> prop. Here’s a simple example:</p>
<pre><code class="lang-javascript">&lt;AMSidebar width={<span class="hljs-string">"270px"</span>}&gt; <span class="hljs-comment">// pass the width you want your sidebar to have</span>

{<span class="hljs-comment">/* Sidebar Content Goes Here */</span>}

&lt;/AMSidebar&gt;
</code></pre>
<p>This initializes the sidebar with a width of <code>270px</code>. You can adjust this width based on your design requirements.</p>
<h3 id="heading-step-5-adding-a-logo-to-the-sidebar">Step 5: Adding a Logo to the Sidebar</h3>
<p>You can add a logo inside the sidebar by using the <code>AMLogo</code> component. To do so, you can provide an <code>img</code> prop to link to a CDN logo image. You can also make the logo clickable by passing a navigation link using the <code>component</code> and <code>href</code> props. Here’s how you can include a logo:</p>
<pre><code class="lang-javascript">&lt;AMSidebar width={<span class="hljs-string">"270px"</span>}&gt;

<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">AMLogo</span> <span class="hljs-attr">img</span>=<span class="hljs-string">"https://adminmart.com/wp-content/uploads/2024/03/logo-admin-mart-news.png"</span>
<span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span>
<span class="hljs-attr">href</span>=<span class="hljs-string">"/"</span> 
&gt;</span>        
Adminmart
<span class="hljs-tag">&lt;/<span class="hljs-name">AMLogo</span>&gt;</span></span>

&lt;/AMSidebar&gt;
</code></pre>
<p>In this example, we’ve added a logo from a CDN using the <code>img</code> prop, used the <code>component</code> prop to pass the <code>Link</code>, and set the navigation path to <code>(/)</code> homepage using the <code>href</code> prop and set the text “AdminMart” as the name of the application.</p>
<h3 id="heading-step-6-creating-a-menu-inside-the-sidebar">Step 6: Creating a Menu Inside the Sidebar</h3>
<p>Now let’s create a menu inside the sidebar using the <code>AMMenu</code> component. You can specify a submenu heading using the <code>subHeading</code> prop. Inside the <code>AMMenu</code>, you can add <code>AMMenuItem</code> components for each item.</p>
<p>You can also provide a <code>link</code> prop along with the <code>component</code> prop to the <code>AMMenuItem</code> to turn the item into a clickable link.</p>
<p>Here’s how you can structure the menu:</p>
<pre><code class="lang-javascript">&lt;AMSidebar
 width={<span class="hljs-string">"270px"</span>}&gt;
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">AMMenu</span> <span class="hljs-attr">subHeading</span>=<span class="hljs-string">"HOME"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span>  <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span>  <span class="hljs-attr">link</span>=<span class="hljs-string">"/"</span>  <span class="hljs-attr">badge</span>=<span class="hljs-string">”true”</span>  <span class="hljs-attr">isSelected</span>=<span class="hljs-string">{true}</span> &gt;</span>
      Modern
    <span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span>&gt;</span>eCommerce<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span>&gt;</span>Analytical<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">AMMenu</span>&gt;</span></span>
&lt;/AMSidebar&gt;
</code></pre>
<p>In this example:</p>
<ul>
<li><p>We’ve added a <code>AMMenu</code> with the heading “HOME”.</p>
</li>
<li><p>The first <code>AMMenuItem</code> has a <code>link</code> prop, so clicking it will navigate to the homepage <code>(/)</code>.</p>
</li>
<li><p>The second and third <code>AMMenuItem</code> components are simple text items without links.</p>
</li>
</ul>
<p>You can use the <code>badge="true"</code> prop to indicate a badge or notification on the <strong>AMMenuItem</strong>. The <code>isSelected={true}</code> prop marks this menu item as currently selected or active (though you can customize this feature according to your needs).</p>
<h3 id="heading-step-7-adding-submenus-optional">Step 7: Adding Submenus (Optional)</h3>
<p>To add submenus inside the main menu, use the <code>AMSubmenu</code> component. The <code>AMSubmenu</code> can be nested inside the <code>AMMenu</code> component and contains its own set of <code>AMMenuItem</code>. Use the <code>title</code> prop to set the submenu heading</p>
<p>Here’s an example of adding a submenu:</p>
<pre><code class="lang-javascript">&lt;AMSidebar  width={<span class="hljs-string">"270px"</span>}&gt;
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">AMMenu</span> <span class="hljs-attr">subHeading</span>=<span class="hljs-string">"SERVICES"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span>  <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span>   <span class="hljs-attr">link</span>=<span class="hljs-string">"/web-development"</span>&gt;</span>Web Development<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span> <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span>  <span class="hljs-attr">link</span>=<span class="hljs-string">"/seo-services"</span>&gt;</span>SEO Services<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">AMSubmenu</span> <span class="hljs-attr">title</span>=<span class="hljs-string">"Marketing"</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span> <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span>  <span class="hljs-attr">link</span>=<span class="hljs-string">"/digital-marketing"</span>&gt;</span>Digital Marketing<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span>
           <span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span> <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span>  <span class="hljs-attr">link</span>=<span class="hljs-string">"/content-marketing"</span>&gt;</span>Content Marketing<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">AMSubmenu</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">AMMenu</span>&gt;</span></span>
&lt;/AMSidebar&gt;
</code></pre>
<p>In this example:</p>
<ul>
<li><p>A submenu under the "Marketing" heading is added inside the "SERVICES" menu.</p>
</li>
<li><p>The submenu contains two <code>AMMenuItem</code> with links to different service pages.</p>
</li>
</ul>
<h2 id="heading-features-of-tailwind-sidebar">Features of Tailwind Sidebar:</h2>
<h3 id="heading-utility-first-amp-lightweight">Utility-First &amp; Lightweight</h3>
<p>Tailwind Sidebar is built entirely using Tailwind CSS utility classes. This means there’s no heavy JavaScript logic or extra styling framework, keeping your bundle size small and performance fast.</p>
<p><strong>Code Example:</strong></p>
<pre><code class="lang-javascript">&lt;AMSidebar width=<span class="hljs-string">"260px"</span> className=<span class="hljs-string">"bg-gray-900 text-white"</span>&gt;
     <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">AMMenu</span>&gt;</span>
           <span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span>&gt;</span>Dashboard<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">AMMenu</span>&gt;</span></span>
 &lt;/AMSidebar&gt;
</code></pre>
<p>What’s going on here:</p>
<ul>
<li><p><code>bg-gray-900 text-white</code>: Applies a dark background and white text <em>directly</em> via Tailwind classes (no separate CSS file).</p>
</li>
<li><p><code>width="260px"</code>: The component prop sets the sidebar width. Here, it shows how Tailwind utilities combine with props to control layout.</p>
</li>
</ul>
<p>Because all spacing and colors are from Tailwind classes, you don’t need additional custom styles.</p>
<h3 id="heading-fully-responsive-design">Fully Responsive Design</h3>
<p>The sidebar adapts seamlessly to different screen sizes. Whether you’re building for desktop, tablet, or mobile, Tailwind Sidebar ensures a smooth and consistent navigation experience.</p>
<p><strong>Example usage:</strong></p>
<pre><code class="lang-javascript">&lt;AMSidebar width=<span class="hljs-string">"260px"</span> className=<span class="hljs-string">"hidden md:block"</span>&gt;
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">AMMenu</span>&gt;</span>
           <span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span>&gt;</span>Home<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">AMMenu</span>&gt;</span></span>
&lt;/AMSidebar&gt;
</code></pre>
<p>What’s going on here:</p>
<ul>
<li><code>hidden md:block</code>: Uses Tailwind <em>responsive utility classes</em> to hide the component (<code>hidden</code>) on mobile screens and show it starting at the <code>md</code> breakpoint (<code>md:block</code>).</li>
</ul>
<p>This pattern is Tailwind’s common way of controlling visibility across breakpoints without media queries.</p>
<h3 id="heading-highly-customizable">Highly Customizable</h3>
<p>Tailwind Sidebar allows full customization of colors, hover states, spacing, and typography directly through Tailwind classes. You can customize layout and animations – all without touching custom CSS files.</p>
<p><strong>Example usage:</strong></p>
<pre><code class="lang-javascript"> &lt;AMMenuItem className=<span class="hljs-string">"hover:bg-blue-600 rounded-lg px-4 py-2”&gt;
      Analytics
  &lt;/AMMenuItem&gt;</span>
</code></pre>
<p>What’s going on here:</p>
<ul>
<li><p><code>hover:bg-blue-600</code>: When you hover the menu item, the background changes to blue, purely via Tailwind.</p>
</li>
<li><p><code>rounded-lg</code>: Adds rounded corners.</p>
</li>
<li><p><code>px-4 py-2</code>: Controls horizontal (<code>px</code>) and vertical (<code>py</code>) padding to adjust spacing.</p>
</li>
</ul>
<p>Together, these utilities show how Tailwind gives control of design details directly at the HTML/JSX level.</p>
<h3 id="heading-integration-with-react-amp-nextjs">Integration with React &amp; Next.Js:</h3>
<p>Tailwind Sidebar seamlessly integrates with both React &amp; Next.js, offering a familiar and efficient development experience.</p>
<p>The sidebar works natively with both <strong>React Router</strong> and <strong>Next.js routing</strong> by passing the <code>Link</code> component.</p>
<pre><code class="lang-javascript">React Example
{
  <span class="hljs-comment">/* if you are using react then import link from  */</span>
}

<span class="hljs-keyword">import</span> { Link } <span class="hljs-keyword">from</span> <span class="hljs-string">"react-router-dom"</span>;
<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span> <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span> <span class="hljs-attr">link</span>=<span class="hljs-string">"/dashboard"</span>&gt;</span>
            Dashboard 
<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span></span>

Next.js Example
{
  <span class="hljs-comment">/* if you are using nextjs then import link from  */</span>
}

<span class="hljs-keyword">import</span> Link <span class="hljs-keyword">from</span> <span class="hljs-string">"next/link"</span>;

<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span> <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span> <span class="hljs-attr">link</span>=<span class="hljs-string">"/dashboard"</span>&gt;</span>
         Dashboard
<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span></span>
</code></pre>
<p>What’s going on here:</p>
<ul>
<li><code>component={Link} link="/dashboard"</code>: Shows how you pass your framework’s routing component into <code>AMMenuItem</code>, turning it into a real navigational link.</li>
</ul>
<p>This means Tailwind Sidebar adapts to both React Router and Next.js routing without boilerplate.</p>
<h3 id="heading-menu-amp-submenu-support">Menu &amp; Submenu Support</h3>
<p>Organize your navigation with:</p>
<ul>
<li><p>Main menu items</p>
</li>
<li><p>Nested submenus</p>
</li>
</ul>
<p>This makes it easy to manage complex navigation structures while keeping the UI clean and intuitive.</p>
<p><strong>Example usage:</strong></p>
<pre><code class="lang-javascript">&lt;AMMenu subHeading=<span class="hljs-string">"MANAGEMENT"</span>&gt;
             <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span>&gt;</span>Users<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span></span>
                <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">AMSubmenu</span> <span class="hljs-attr">title</span>=<span class="hljs-string">"Reports"</span>&gt;</span>
                   <span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span>&gt;</span>Sales<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span>
                      <span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span>&gt;</span>Revenue<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span>
                    <span class="hljs-tag">&lt;/<span class="hljs-name">AMSubmenu</span>&gt;</span></span>
&lt;/AMMenu&gt;
</code></pre>
<p>What’s going on here:</p>
<ul>
<li><p><code>subHeading="SERVICES"</code>: Adds a labeled grouping for menu items.</p>
</li>
<li><p>The nested <code>&lt;AMSubmenu&gt;</code> demonstrates how nested navigation is rendered and structured in JSX.</p>
</li>
</ul>
<p>This example clearly shows hierarchical menus without additional CSS – structure and Tailwind classes handle layout.</p>
<h3 id="heading-icon-support">Icon Support</h3>
<p>The sidebar comes with built-in support for icons, allowing developers to enhance the visual appeal and usability of their application. Developers can use any icon library and provide the icon component.</p>
<p><strong>Example using lucide-react:</strong></p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { Home } <span class="hljs-keyword">from</span> <span class="hljs-string">"lucide-react"</span>;

<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span> <span class="hljs-attr">icon</span>=<span class="hljs-string">{</span>&lt;<span class="hljs-attr">Home</span> <span class="hljs-attr">size</span>=<span class="hljs-string">{18}</span> /&gt;</span>}&gt;
     Home
<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span></span>
</code></pre>
<p>What’s going on here:</p>
<ul>
<li><p><code>icon={&lt;Home size={18} /&gt;}</code>: Here, an icon component is passed as a prop.</p>
</li>
<li><p>You control the size directly via the icon library (Lucide here) and Tailwind handles spacing/placement next to text.</p>
</li>
</ul>
<p>This illustrates how icons and text combine in the sidebar component.</p>
<h3 id="heading-smooth-transitions">Smooth Transitions</h3>
<p>Tailwind Sidebar provides built-in animation support through the animation prop. When enabled, menu items and submenus animate smoothly, improving the overall user experience without requiring custom CSS or JavaScript.</p>
<p><strong>Example Usage:</strong></p>
<pre><code class="lang-javascript">&lt;AMSidebar width=<span class="hljs-string">"270px"</span> animation={<span class="hljs-literal">true</span>}&gt;
           <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">AMMenu</span> <span class="hljs-attr">subHeading</span>=<span class="hljs-string">"SETTINGS"</span>&gt;</span>
                  <span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span>&gt;</span>Profile<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span>
                  <span class="hljs-tag">&lt;<span class="hljs-name">AMMenuItem</span>&gt;</span>Security<span class="hljs-tag">&lt;/<span class="hljs-name">AMMenuItem</span>&gt;</span>
             <span class="hljs-tag">&lt;/<span class="hljs-name">AMMenu</span>&gt;</span></span>
&lt;/AMSidebar&gt;
</code></pre>
<p>What’s going on here:</p>
<ul>
<li><code>animation={true}</code>: Enables built-in animation support.</li>
</ul>
<p>The example shows how adding this prop triggers smooth transitions defined by the component itself (still relying on Tailwind utilities internally). You don’t have to write CSS keyframes or transition utilities manually.</p>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>You have now successfully integrated a fully functional sidebar in your React and Next.js application using <code>tailwind-sidebar</code>. You can further customize the sidebar by:</p>
<ul>
<li><p>Modifying the width and design.</p>
</li>
<li><p>Adding more submenus, menu items, or icons.</p>
</li>
<li><p>Using links to navigate between pages.</p>
</li>
</ul>
<p>This setup provides a flexible, responsive, and easy-to-use sidebar, which is perfect for most web applications.</p>
<p>If you want to see how this kind of sidebar fits into a real dashboard layout, you can explore an open-source Tailwind CSS admin template at <a target="_blank" href="https://tailwind-admin.com/">https://tailwind-admin.com/</a>.</p>
<h3 id="heading-try-it-out">Try It Out:</h3>
<p>You can view the working demo of the tailwind-sidebar here: <a target="_blank" href="https://tailwind-admin-react-free.netlify.app/"><strong>View Demo</strong></a><strong>.</strong></p>
<p><strong>Note:</strong> in this tutorial, we utilized <code>lucide-react</code> to construct this sidebar. Feel free to choose an alternative library or use different icons based on your specific requirements.</p>
<h3 id="heading-other-sidebar-npm-packages">Other Sidebar NPM Packages</h3>
<p>You can also try <a target="_blank" href="https://www.npmjs.com/package/nextjs-tailwind-sidebar"><strong>Next.js Tailwind Sidebar</strong></a> – a simple and responsive sidebar built for Next.js, and <a target="_blank" href="https://www.npmjs.com/package/react-tailwind-sidebar"><strong>React Tailwind Sidebar</strong></a> – a lightweight Tailwind-based sidebar for React applications.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Build a Chrome Extension That Analyzes Any Web Page Using JavaScript and Manifest V3 ]]>
                </title>
                <description>
                    <![CDATA[ Have you ever visited a website and wondered how well is this page structured? Does it have a meta description? How many links or headings does it use? Usually, you’d open DevTools or an SEO auditing tool to find answers to these questions. But what ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-build-a-chrome-extension-using-javascript-and-manifest-v3/</link>
                <guid isPermaLink="false">6900f612596c2221585d95a4</guid>
                
                    <category>
                        <![CDATA[ chrome extension ]]>
                    </category>
                
                    <category>
                        <![CDATA[ ai seo ]]>
                    </category>
                
                    <category>
                        <![CDATA[ devtools ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Hitesh Chauhan ]]>
                </dc:creator>
                <pubDate>Tue, 28 Oct 2025 16:57:54 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1761670419000/13ac96ca-6e28-413f-a0e0-56ed353a007c.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Have you ever visited a website and wondered how well is this page structured? Does it have a meta description? How many links or headings does it use?</p>
<p>Usually, you’d open DevTools or an SEO auditing tool to find answers to these questions. But what if you could analyze any web page instantly, without leaving your browser?</p>
<p>In this tutorial, you’ll learn how to build a Chrome extension that scans and analyzes any webpage for titles, meta descriptions, headings, and links.</p>
<p>By the end of this article, you’ll:</p>
<ul>
<li><p>Understand how Manifest V3 works in Chrome Extensions</p>
</li>
<li><p>Learn how to inject content scripts into web pages</p>
</li>
<li><p>Build a popup UI that fetches and displays structured data</p>
</li>
<li><p>Explore how this same foundation can be extended with AI-powered insights</p>
</li>
</ul>
<p>💡 This guide focuses on learning and education – no frameworks or build tools required. Just HTML, CSS, and vanilla JavaScript.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><p><a class="post-section-overview" href="#heading-prerequisites">Prerequisites</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-1-understanding-how-chrome-extensions-work">Step 1: Understanding How Chrome Extensions Work</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-2-set-up-the-project-structure">Step 2: Set Up the Project Structure</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-3-define-the-manifest-file">Step 3: Define the Manifest File</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-4-create-the-popup-ui">Step 4: Create the Popup UI</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-5-write-the-content-script-contentjs">Step 5: Write the Content Script (content.js)</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-6-connect-the-popup-and-content-script">Step 6: Connect the Popup and Content Script</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-7-load-and-test-your-extension">Step 7: Load and Test Your Extension</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-8-add-optional-enhancements">Step 8: Add Optional Enhancements</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-step-9-publish-to-the-chrome-web-store">Step 9: Publish to the Chrome Web Store</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-final-thoughts">Final Thoughts</a></p>
</li>
</ul>
<h2 id="heading-prerequisites">🧰 Prerequisites</h2>
<p>Before starting this tutorial, make sure you have:</p>
<ul>
<li><p>A basic understanding of HTML, CSS, and JavaScript</p>
</li>
<li><p>A recent version of Google Chrome installed on your system</p>
</li>
<li><p>Familiarity with using Chrome DevTools (optional but helpful)</p>
</li>
<li><p>A code editor like VS Code or Sublime Text</p>
</li>
<li><p>A local folder where you can create and organize your extension files</p>
</li>
</ul>
<p>💡 Again, no frameworks or build tools are required. We’ll use only vanilla JavaScript and simple web technologies throughout this guide.</p>
<h2 id="heading-step-1-understanding-how-chrome-extensions-work">🧩 Step 1: Understanding How Chrome Extensions Work</h2>
<p>A Chrome extension is just a bundle of web technologies – HTML, CSS, and JS – that extends browser functionality.</p>
<p>Extensions can have multiple parts:</p>
<ul>
<li><p><strong>Manifest file</strong> (<code>manifest.json</code>): defines permissions, icons, and structure.</p>
</li>
<li><p><strong>Content scripts</strong>: run inside web pages and access the DOM.</p>
</li>
<li><p><strong>Background scripts</strong>: handle long-running or event-driven logic.</p>
</li>
<li><p><strong>Popup UI</strong>: what users see when they click your extension icon.</p>
</li>
</ul>
<p>Here’s a high-level flow of what we’ll build:</p>
<pre><code class="lang-plaintext">[Popup UI] &lt;—&gt; [Content Script] &lt;—&gt; [Web Page DOM]
</code></pre>
<p>When the user clicks “Analyze,” the popup will send a message to the content script. The script will then read the DOM and send back results like page title, description, headings, and links.</p>
<h2 id="heading-step-2-set-up-the-project-structure">🧠 Step 2: Set Up the Project Structure</h2>
<p>Create a new folder called <code>page-analyzer-extension</code>. Inside it, create these files:</p>
<pre><code class="lang-plaintext">page-analyzer-extension/
│
├── manifest.json
├── popup.html
├── popup.js
├── content.js
├── styles.css
└── icons/
    ├── icon16.png
    ├── icon48.png
    └── icon128.png
</code></pre>
<p>Icons are optional, but they make the extension look professional. You can use placeholders or generate them from <a target="_blank" href="https://favicon.io/">favicon.io</a>.</p>
<h2 id="heading-step-3-define-the-manifest-file">⚙️ Step 3: Define the Manifest File</h2>
<p>Create <code>manifest.json</code> and paste this in:</p>
<pre><code class="lang-json">{
  <span class="hljs-attr">"manifest_version"</span>: <span class="hljs-number">3</span>,
  <span class="hljs-attr">"name"</span>: <span class="hljs-string">"Page Analyzer"</span>,
  <span class="hljs-attr">"version"</span>: <span class="hljs-string">"1.0"</span>,
  <span class="hljs-attr">"description"</span>: <span class="hljs-string">"Analyze any web page for its title, description, headings, and links."</span>,
  <span class="hljs-attr">"permissions"</span>: [<span class="hljs-string">"activeTab"</span>, <span class="hljs-string">"scripting"</span>],
  <span class="hljs-attr">"action"</span>: {
    <span class="hljs-attr">"default_popup"</span>: <span class="hljs-string">"popup.html"</span>,
    <span class="hljs-attr">"default_icon"</span>: {
      <span class="hljs-attr">"16"</span>: <span class="hljs-string">"icons/icon16.png"</span>,
      <span class="hljs-attr">"48"</span>: <span class="hljs-string">"icons/icon48.png"</span>,
      <span class="hljs-attr">"128"</span>: <span class="hljs-string">"icons/icon128.png"</span>
    }
  },
  <span class="hljs-attr">"content_scripts"</span>: [
    {
      <span class="hljs-attr">"matches"</span>: [<span class="hljs-string">"&lt;all_urls&gt;"</span>],
      <span class="hljs-attr">"js"</span>: [<span class="hljs-string">"content.js"</span>]
    }
  ]
}
</code></pre>
<p>Let’s break this down:</p>
<ul>
<li><p><code>manifest_version: 3</code>: the latest version with security and performance improvements</p>
</li>
<li><p><code>permissions</code>: allow the extension to access the active tab and run scripts</p>
</li>
<li><p><code>content_scripts</code>: define which JS files should automatically run in web pages</p>
</li>
</ul>
<h2 id="heading-step-4-create-the-popup-ui">🧩 Step 4: Create the Popup UI</h2>
<p>The popup appears when users click the extension icon.</p>
<p><code>popup.html</code>:</p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Page Analyzer<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">link</span> <span class="hljs-attr">rel</span>=<span class="hljs-string">"stylesheet"</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"styles.css"</span> /&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span>Page Analyzer<span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Click below to analyze the current page:<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"analyze"</span>&gt;</span>Analyze Page<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"results"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>

    <span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"popup.js"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p><code>styles.css</code>:</p>
<pre><code class="lang-css"><span class="hljs-selector-tag">body</span> {
  <span class="hljs-attribute">font-family</span>: system-ui, sans-serif;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">12px</span>;
  <span class="hljs-attribute">width</span>: <span class="hljs-number">280px</span>;
}
<span class="hljs-selector-tag">button</span> {
  <span class="hljs-attribute">background</span>: <span class="hljs-number">#2563eb</span>;
  <span class="hljs-attribute">color</span>: white;
  <span class="hljs-attribute">border</span>: none;
  <span class="hljs-attribute">padding</span>: <span class="hljs-number">8px</span> <span class="hljs-number">14px</span>;
  <span class="hljs-attribute">border-radius</span>: <span class="hljs-number">6px</span>;
  <span class="hljs-attribute">cursor</span>: pointer;
  <span class="hljs-attribute">font-weight</span>: <span class="hljs-number">500</span>;
}
<span class="hljs-selector-id">#results</span> {
  <span class="hljs-attribute">margin-top</span>: <span class="hljs-number">12px</span>;
  <span class="hljs-attribute">font-size</span>: <span class="hljs-number">13px</span>;
  <span class="hljs-attribute">line-height</span>: <span class="hljs-number">1.4</span>;
  <span class="hljs-attribute">word-wrap</span>: break-word;
}
</code></pre>
<h2 id="heading-step-5-write-the-content-script-contentjs">🧠 Step 5: Write the Content Script (<code>content.js</code>)</h2>
<p>This script will analyze the web page.</p>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">analyzePage</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> title = <span class="hljs-built_in">document</span>.title || <span class="hljs-string">"No title found"</span>;
  <span class="hljs-keyword">const</span> description =
    <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">'meta[name="description"]'</span>)?.content || <span class="hljs-string">"No description found"</span>;
  <span class="hljs-keyword">const</span> headings = <span class="hljs-built_in">Array</span>.from(<span class="hljs-built_in">document</span>.querySelectorAll(<span class="hljs-string">"h1, h2, h3"</span>)).map(<span class="hljs-function">(<span class="hljs-params">h</span>) =&gt;</span>
    h.innerText.trim()
  );
  <span class="hljs-keyword">const</span> links = <span class="hljs-built_in">document</span>.querySelectorAll(<span class="hljs-string">"a"</span>).length;

  <span class="hljs-keyword">return</span> {
    title,
    description,
    headings,
    <span class="hljs-attr">linkCount</span>: links,
    <span class="hljs-attr">domain</span>: location.hostname,
  };
}

chrome.runtime.onMessage.addListener(<span class="hljs-function">(<span class="hljs-params">message, sender, sendResponse</span>) =&gt;</span> {
  <span class="hljs-keyword">if</span> (message.action === <span class="hljs-string">"analyze"</span>) {
    sendResponse(analyzePage());
  }
});
</code></pre>
<p>What’s happening here:</p>
<ul>
<li><p>We extract the title, description, headings, and total link count</p>
</li>
<li><p>We return this data as a structured object</p>
</li>
<li><p>The script listens for messages from the popup and responds with the analysis</p>
</li>
</ul>
<h2 id="heading-step-6-connect-the-popup-and-content-script">⚡ Step 6: Connect the Popup and Content Script</h2>
<p>In <code>popup.js</code>, add the logic that triggers page analysis.</p>
<pre><code class="lang-js"><span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"analyze"</span>).addEventListener(<span class="hljs-string">"click"</span>, <span class="hljs-keyword">async</span> () =&gt; {
  <span class="hljs-keyword">const</span> [tab] = <span class="hljs-keyword">await</span> chrome.tabs.query({ <span class="hljs-attr">active</span>: <span class="hljs-literal">true</span>, <span class="hljs-attr">currentWindow</span>: <span class="hljs-literal">true</span> });

  chrome.tabs.sendMessage(tab.id, { <span class="hljs-attr">action</span>: <span class="hljs-string">"analyze"</span> }, <span class="hljs-function">(<span class="hljs-params">response</span>) =&gt;</span> {
    <span class="hljs-keyword">const</span> resultContainer = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"results"</span>);

    <span class="hljs-keyword">if</span> (!response) {
      resultContainer.innerText = <span class="hljs-string">"Unable to analyze this page."</span>;
      <span class="hljs-keyword">return</span>;
    }

    <span class="hljs-keyword">const</span> { title, description, headings, linkCount, domain } = response;
    resultContainer.innerHTML = <span class="hljs-string">`
      &lt;strong&gt;Domain:&lt;/strong&gt; <span class="hljs-subst">${domain}</span>&lt;br/&gt;
      &lt;strong&gt;Title:&lt;/strong&gt; <span class="hljs-subst">${title}</span>&lt;br/&gt;
      &lt;strong&gt;Description:&lt;/strong&gt; <span class="hljs-subst">${description}</span>&lt;br/&gt;
      &lt;strong&gt;Headings:&lt;/strong&gt; <span class="hljs-subst">${
        headings.length ? headings.join(<span class="hljs-string">", "</span>) : <span class="hljs-string">"No headings found"</span>
      }</span>&lt;br/&gt;
      &lt;strong&gt;Links:&lt;/strong&gt; <span class="hljs-subst">${linkCount}</span>
    `</span>;
  });
});
</code></pre>
<p>This uses the <strong>Chrome Tabs API</strong> to find the current tab and send a message to the content script. When the script responds, we update the popup with the results.</p>
<h2 id="heading-step-7-load-and-test-your-extension">🧪 Step 7: Load and Test Your Extension</h2>
<ol>
<li><p>Open chrome://extensions/</p>
</li>
<li><p>Enable Developer Mode</p>
</li>
<li><p>Click Load Unpacked</p>
</li>
<li><p>Select your project folder</p>
</li>
</ol>
<p>Now, pin your extension to the toolbar, open any website, and click “Analyze Page.”</p>
<p>You’ll instantly see:</p>
<ul>
<li><p>The page’s title</p>
</li>
<li><p>Meta description</p>
</li>
<li><p>Extracted headings (H1–H3)</p>
</li>
<li><p>Link count</p>
</li>
<li><p>Domain name</p>
</li>
</ul>
<p>🎉 Congratulations! You’ve built a working web page analyzer.</p>
<h2 id="heading-step-8-add-optional-enhancements">🧩 Step 8: Add Optional Enhancements</h2>
<p>Now that the basics work, here are some ways to level up your project.</p>
<h3 id="heading-1-add-ai-insights">🧠 1. Add AI Insights</h3>
<p>You can connect to an AI API (like OpenAI or Gemini) to summarize the page or evaluate SEO structure.</p>
<pre><code class="lang-js"><span class="hljs-comment">// Example: pseudo-code for calling an AI API</span>
<span class="hljs-keyword">const</span> aiResponse = <span class="hljs-keyword">await</span> fetch(<span class="hljs-string">"https://api.openai.com/v1/chat/completions"</span>, {
  <span class="hljs-attr">method</span>: <span class="hljs-string">"POST"</span>,
  <span class="hljs-attr">headers</span>: { <span class="hljs-attr">Authorization</span>: <span class="hljs-string">`Bearer <span class="hljs-subst">${API_KEY}</span>`</span> },
  <span class="hljs-attr">body</span>: <span class="hljs-built_in">JSON</span>.stringify({
    <span class="hljs-attr">model</span>: <span class="hljs-string">"gpt-4o-mini"</span>,
    <span class="hljs-attr">messages</span>: [
      { <span class="hljs-attr">role</span>: <span class="hljs-string">"system"</span>, <span class="hljs-attr">content</span>: <span class="hljs-string">"You are an SEO assistant."</span> },
      { <span class="hljs-attr">role</span>: <span class="hljs-string">"user"</span>, <span class="hljs-attr">content</span>: <span class="hljs-string">`Analyze the following page info: <span class="hljs-subst">${<span class="hljs-built_in">JSON</span>.stringify(pageData)}</span>`</span> }
    ]
  })
});
</code></pre>
<p>For example, after building this basic analyzer, I expanded it into a full-featured <a target="_blank" href="https://rankingsfactor.com/extension">RankingsFactor AI SEO Extension</a> which combines this same foundation with:</p>
<ul>
<li><p>AI-generated keyword suggestions</p>
</li>
<li><p>Metadata improvement recommendations</p>
</li>
<li><p>Automatic screenshot capture</p>
</li>
<li><p>Page freshness detection</p>
</li>
</ul>
<p>This demonstrates how a simple developer project can evolve into a powerful, production-ready tool.</p>
<h3 id="heading-2-detect-missing-seo-tags">🔍 2. Detect Missing SEO Tags</h3>
<p>You can check for missing tags like this:</p>
<pre><code class="lang-js"><span class="hljs-keyword">const</span> missingTags = [];
<span class="hljs-keyword">if</span> (!<span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">'meta[name="description"]'</span>)) missingTags.push(<span class="hljs-string">"description"</span>);
<span class="hljs-keyword">if</span> (!<span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">'meta[property="og:title"]'</span>)) missingTags.push(<span class="hljs-string">"og:title"</span>);
</code></pre>
<h3 id="heading-3-add-screenshot-or-report-export">🖼️ 3. Add Screenshot or Report Export</h3>
<p>Use the <code>chrome.tabs.captureVisibleTab()</code> API to take a screenshot, or generate a downloadable HTML/JSON report.</p>
<h2 id="heading-step-9-publish-to-the-chrome-web-store">🧭 Step 9: Publish to the Chrome Web Store</h2>
<p>Once you’ve tested your extension, visit <a target="_blank" href="https://chrome.google.com/webstore/devconsole">chrome.google.com/webstore/devconsole</a>. You’ll need to pay a one-time $5 developer registration fee, then you can upload your extension as a ZIP file. Make sure you write a clear, helpful description before submitting your extension for review.</p>
<h2 id="heading-final-thoughts">✅ Final Thoughts</h2>
<p>In this tutorial, you learned:</p>
<ul>
<li><p>How Chrome extensions communicate between scripts and web pages</p>
</li>
<li><p>How to safely extract DOM data</p>
</li>
<li><p>How to display structured information in a popup UI</p>
</li>
<li><p>How to extend browser tools with AI for smarter analysis</p>
</li>
</ul>
<p>Browser extensions are an incredible way to bring web automation, analysis, and creativity directly into your workflow. Whether you’re analyzing pages, improving accessibility, or experimenting with AI, you now have the foundation to build anything you imagine.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Use the react-mui-sidebar Package to Build Responsive, Customizable Sidebars ]]>
                </title>
                <description>
                    <![CDATA[ In modern web development, a well-designed sidebar can greatly improve the user experience by providing easy navigation and access to important features. The react-mui-sidebar, powered by Material-UI, is a helpful React NPM package designed to make i... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-use-react-mui-sidebar-to-build-responsive-customizable-sidebars/</link>
                <guid isPermaLink="false">68e841313a3a459fe2b24ab2</guid>
                
                    <category>
                        <![CDATA[ React ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Next.js ]]>
                    </category>
                
                    <category>
                        <![CDATA[ npm ]]>
                    </category>
                
                    <category>
                        <![CDATA[ material ui ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Design ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Hitesh Chauhan ]]>
                </dc:creator>
                <pubDate>Thu, 09 Oct 2025 23:11:45 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1760051493063/cc42647f-21e7-48f6-873f-b17db780a24a.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In modern web development, a well-designed sidebar can greatly improve the user experience by providing easy navigation and access to important features.</p>
<p>The <a target="_blank" href="https://www.npmjs.com/package/react-mui-sidebar">react-mui-sidebar</a>, powered by <a target="_blank" href="https://mui.com/">Material-UI</a>, is a helpful React NPM package designed to make it easier to build responsive and highly customizable sidebars.</p>
<p>In this article, we will explore the key aspects of react-mui-sidebar and how you can use it to elevate the sidebar experience in your React applications.</p>
<h2 id="heading-table-of-contents"><strong>Table of Contents</strong></h2>
<ul>
<li><p><a class="post-section-overview" href="#heading-prerequisites">Prerequisites</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-what-is-mui-material-ui">What is MUI (Material-UI)?</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-why-choose-react-mui-sidebar">Why Choose react-mui-sidebar?</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-get-started-with-react-mui-sidebar">How to Get Started with react-mui-sidebar</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-wrapping-up">Wrapping Up</a></p>
</li>
</ul>
<h2 id="heading-prerequisites"><strong>Prerequisites</strong></h2>
<p>Before diving into the tutorial, make sure you have the following:</p>
<ul>
<li><p><strong>Basics of React</strong> like components, props, state, and JSX</p>
</li>
<li><p><strong>Familiarity with React Router or Next.js App Router</strong> so you know how linking/navigation works</p>
</li>
<li><p><strong>Understanding of Material-UI / MUI</strong>: theming, components, styling</p>
</li>
<li><p><strong>NPM / Yarn package usage</strong>: installing, importing, and managing dependencies</p>
</li>
<li><p><strong>Basic CSS / layout skills</strong>: Flexbox, widths, responsive design, and so on</p>
</li>
</ul>
<p>Here’s what we’ll be building:</p>
<p><a target="_blank" href="https://www.npmjs.com/package/react-mui-sidebar"><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756104211843/d56fb298-d190-4d14-9923-e7ec0827a662.jpeg" alt="d56fb298-d190-4d14-9923-e7ec0827a662" class="image--center mx-auto" width="1051" height="867" loading="lazy"></a></p>
<p>Here’s a <a target="_blank" href="https://react-mui-sidebar.vercel.app/">live demo</a> you can check out, too.</p>
<h2 id="heading-what-is-mui-material-ui"><strong>What is MUI (Material-UI)?</strong></h2>
<p>Material-UI is a widely adopted React UI framework that brings Google's Material Design principles to React applications. React MUI Sidebar leverages the strengths of Material-UI, providing a seamless integration for creating visually appealing and responsive sidebars.</p>
<h3 id="heading-features-of-react-mui-sidebar"><strong>Features of React MUI Sidebar</strong></h3>
<ol>
<li><p><strong>Responsive design:</strong> React MUI Sidebar ensures a consistent and adaptive layout across various screen sizes, catering to the increasing demand for mobile-friendly interfaces.</p>
</li>
<li><p><strong>Customization options:</strong> You can easily change the appearance of the sidebar to match the overall design of you application, allowing for a cohesive and branded look.</p>
</li>
<li><p><strong>Integration with React and Next.js:</strong> React MUI Sidebar seamlessly integrates with both React and Next.js, offering a familiar and efficient development experience.</p>
</li>
<li><p><strong>User-friendly:</strong> React MUI Sidebar is designed with simplicity in mind, making it easy to incorporate into your projects. With intuitive documentation, you can quickly grasp and implement the sidebar functionality.</p>
</li>
<li><p><strong>Icons support:</strong> The sidebar comes with built-in support for icons, helping you enhance the visual appeal and usability of your applications. You can use any icon library and provide the icon component.</p>
</li>
<li><p><strong>Menu and submenu support:</strong> It provides a hierarchical structure with support for both main menus and nested submenus. This feature enables you to organize and present complex navigation structures in a clear and intuitive manner.</p>
</li>
<li><p><strong>Smooth transitions:</strong> The sidebar incorporates smooth transition effects, enhancing the overall user experience by providing a visually pleasing navigation flow. Animations are thoughtfully implemented to avoid any jarring effects during sidebar interactions.</p>
</li>
</ol>
<h2 id="heading-why-choose-react-mui-sidebar"><strong>Why Choose react-mui-sidebar?</strong></h2>
<p>There are various reasons to use this helpful tool. Here are a few big ones:</p>
<h3 id="heading-optimized-performance"><strong>Optimized Performance</strong></h3>
<p>react-mui-sidebar is designed and configured for high performance, ensuring smooth and responsive user interactions. Internally, it minimizes re-renders via memoization so that only parts of the menu that actually change are updated. It uses lightweight DOM structure and conditional rendering of nested items to avoid unnecessary mounting.</p>
<p>Since it's built on MUI, it also leverages efficient styling via the <code>sx</code> prop or styled components rather than heavy theme recalculations.</p>
<p>These features are crucial for applications, especially those with complex or intricate user interfaces, where performance issues can negatively impact the user experience.</p>
<h3 id="heading-community-strength"><strong>Community Strength</strong></h3>
<p>React MUI Sidebar benefits from a large and active user base thanks in part to the large and active Material UI community. This is helpful for users because it means there's a wealth of resources, tutorials, and assistance available.</p>
<p>A strong community can contribute to the growth of the framework, provide solutions to common issues, and foster collaboration among developers.</p>
<h3 id="heading-reliable-maintenance"><strong>Reliable Maintenance</strong></h3>
<p>react-mui-sidebar is actively supported by consistent updates and proactive maintenance from its community. Regular updates often include bug fixes, security patches, and new features, which help make sure that the framework remains current and adaptable to users’ evolving needs. This is especially important for long-term projects, and shows a commitment to the ongoing improvement and support of the framework.</p>
<h2 id="heading-how-to-get-started-with-react-mui-sidebar"><strong>How to Get Started with react-mui-sidebar</strong></h2>
<p>In this tutorial, I’ll walk you through installing and setting up react-mui-sidebar in a React and Next.js application. You’ll learn how to integrate the sidebar, add a logo, create menus, and use links.</p>
<h3 id="heading-step-1-install-react-mui-sidebar">Step 1: Install react-mui-sidebar</h3>
<p>To begin, you’ll need to install the <a target="_blank" href="https://www.npmjs.com/package/react-mui-sidebar">react-mui-sidebar package</a> into your React and Next.js project. You can do this using either npm or yarn.</p>
<h4 id="heading-using-npm">Using npm:</h4>
<pre><code class="lang-javascript">npm install react-mui-sidebar
</code></pre>
<h4 id="heading-using-yarn">Using yarn:</h4>
<pre><code class="lang-javascript">yarn add react-mui-sidebar
</code></pre>
<p>This will add react-mui-sidebar and its dependencies to your project.</p>
<h3 id="heading-step-2-import-the-react-mui-sidebar-component">Step 2: Import the React MUI Sidebar Component</h3>
<p>Once the package is installed, you can import the necessary components from react-mui-sidebar into your project. These components will allow you to customize the sidebar with menus, submenus, and even a logo.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { Sidebar, Menu, MenuItem, Submenu, Logo } <span class="hljs-keyword">from</span> <span class="hljs-string">"react-mui-sidebar"</span>;
</code></pre>
<h3 id="heading-step-3-set-up-routing-for-react-app-or-nextjs-app">Step 3: Set Up Routing for React App or Next.js App</h3>
<p>To enable navigation inside react-mui-sidebar components like MenuItem or Logo, you need to pass a link component from either react-router or next/link using the component prop inside the corresponding component like what’s shown in the below example:</p>
<p>If you're using <strong>React Router:</strong></p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { Link } <span class="hljs-keyword">from</span> <span class="hljs-string">"react-router-dom"</span>;

<span class="hljs-keyword">const</span> App = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">Sidebar</span> <span class="hljs-attr">width</span>=<span class="hljs-string">{</span>"<span class="hljs-attr">270px</span>"}&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">Logo</span>
        <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span>  // <span class="hljs-attr">Passing</span> <span class="hljs-attr">link</span> <span class="hljs-attr">to</span> <span class="hljs-attr">component</span> <span class="hljs-attr">for</span> <span class="hljs-attr">routing</span>
        <span class="hljs-attr">href</span>=<span class="hljs-string">"/"</span>
        <span class="hljs-attr">img</span>=<span class="hljs-string">"https://adminmart.com/wp-content/uploads/2024/03/logo-admin-mart-news.png"</span>
      &gt;</span>
        AdminMart
      <span class="hljs-tag">&lt;/<span class="hljs-name">Logo</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">Menu</span> <span class="hljs-attr">subHeading</span>=<span class="hljs-string">"HOME"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">MenuItem</span>
          <span class="hljs-attr">icon</span>=<span class="hljs-string">{</span>&lt;<span class="hljs-attr">CottageOutlinedIcon</span> /&gt;</span>}
          component={Link} // Passing link to component for routing
          link="/tes"
          badge={true}
          isSelected={true}
        &gt;
          {" "}
          {/* text for your link */}
          Link Text
        <span class="hljs-tag">&lt;/<span class="hljs-name">MenuItem</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">Menu</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">Sidebar</span>&gt;</span></span>
  );
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> App;
</code></pre>
<p>If you're using <strong>Next.js App Router:</strong></p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> Link <span class="hljs-keyword">from</span> <span class="hljs-string">"next/link"</span>;

<span class="hljs-keyword">const</span> App = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">Sidebar</span> <span class="hljs-attr">width</span>=<span class="hljs-string">{</span>"<span class="hljs-attr">270px</span>"}&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">Logo</span>
        <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span>  // <span class="hljs-attr">Passing</span> <span class="hljs-attr">link</span> <span class="hljs-attr">to</span> <span class="hljs-attr">component</span> <span class="hljs-attr">for</span> <span class="hljs-attr">routing</span>
        <span class="hljs-attr">href</span>=<span class="hljs-string">"/"</span>
        <span class="hljs-attr">img</span>=<span class="hljs-string">"https://adminmart.com/wp-content/uploads/2024/03/logo-admin-mart-news.png"</span>
      &gt;</span>
        AdminMart
      <span class="hljs-tag">&lt;/<span class="hljs-name">Logo</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">Menu</span> <span class="hljs-attr">subHeading</span>=<span class="hljs-string">"HOME"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">MenuItem</span>
          <span class="hljs-attr">icon</span>=<span class="hljs-string">{</span>&lt;<span class="hljs-attr">CottageOutlinedIcon</span> /&gt;</span>}
          component={Link} // Passing link to component for routing
          link="/tes"
          badge={true}
          isSelected={true}
        &gt;
          {" "}
          {/* text for your link */}
          Link Text
        <span class="hljs-tag">&lt;/<span class="hljs-name">MenuItem</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">Menu</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">Sidebar</span>&gt;</span></span>
  );
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> App;
</code></pre>
<h3 id="heading-step-4-initialize-the-sidebar">Step 4: Initialize the Sidebar</h3>
<p>Now we’ll set up the Sidebar component in your application. You can set the width of the sidebar using the width prop. Here’s a simple example:</p>
<pre><code class="lang-javascript">&lt;Sidebar width={<span class="hljs-string">"270px"</span>}&gt; <span class="hljs-comment">// pass the width you want your sidebar to have</span>
  {<span class="hljs-comment">/* Sidebar Content Goes Here */</span>}
&lt;/Sidebar&gt;
</code></pre>
<p>This initializes the sidebar with a width of 270px. You can adjust this width based on your design requirements.</p>
<h3 id="heading-step-5-add-a-logo-to-the-sidebar">Step 5: Add a Logo to the Sidebar</h3>
<p>You can add a logo inside the sidebar by using the Logo component. To do so, you can provide an src URL or use the img prop to link to a CDN logo image. You can also make the logo clickable by passing a navigation link using the component and href props. Here’s how to do this:</p>
<pre><code class="lang-javascript">&lt;Sidebar width={<span class="hljs-string">"270px"</span>}&gt;
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">Logo</span> 
    <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span> 
    <span class="hljs-attr">href</span>=<span class="hljs-string">”/”</span>
    <span class="hljs-attr">img</span>=<span class="hljs-string">"https://adminmart.com/wp-content/uploads/2024/03/logo-admin-mart-news.png"</span> // <span class="hljs-attr">path</span> <span class="hljs-attr">for</span> <span class="hljs-attr">image</span> <span class="hljs-attr">you</span> <span class="hljs-attr">want</span> <span class="hljs-attr">to</span> <span class="hljs-attr">use</span> <span class="hljs-attr">as</span> <span class="hljs-attr">your</span> <span class="hljs-attr">logo</span>
  &gt;</span>
    AdminMart
  <span class="hljs-tag">&lt;/<span class="hljs-name">Logo</span>&gt;</span></span>
&lt;/Sidebar&gt;
</code></pre>
<p>In this example, we’ve added a logo from a CDN using the img prop, used the component prop to pass the Link, and set the navigation path to (/) (the homepage) using the href prop. We’ve also set the text “AdminMart” as the name of the application.</p>
<h3 id="heading-step-6-create-a-menu-inside-the-sidebar">Step 6: Create a Menu Inside the Sidebar</h3>
<p>Now let’s create a menu inside the sidebar using the Menu component. You can specify a submenu heading using the subHeading prop. Inside the Menu, you can add MenuItem components for each item.</p>
<p>You can also provide a link prop along with the component prop to the MenuItem to turn the item into a clickable link.</p>
<p>Here’s how you can structure the menu:</p>
<pre><code class="lang-javascript">&lt;Sidebar width={<span class="hljs-string">"270px"</span>}&gt;
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">Menu</span> <span class="hljs-attr">subHeading</span>=<span class="hljs-string">"HOME"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">MenuItem</span> <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span>  <span class="hljs-attr">link</span>=<span class="hljs-string">"/"</span>  <span class="hljs-attr">badge</span>=<span class="hljs-string">”true”</span>  <span class="hljs-attr">isSelected</span>=<span class="hljs-string">{true}</span> &gt;</span>
      Modern
    <span class="hljs-tag">&lt;/<span class="hljs-name">MenuItem</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">MenuItem</span>&gt;</span>eCommerce<span class="hljs-tag">&lt;/<span class="hljs-name">MenuItem</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">MenuItem</span>&gt;</span>Analytical<span class="hljs-tag">&lt;/<span class="hljs-name">MenuItem</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">Menu</span>&gt;</span></span>
&lt;/Sidebar&gt;
</code></pre>
<p>In this example:</p>
<ul>
<li><p>We’ve added a Menu with the heading “HOME”.</p>
</li>
<li><p>The first MenuItem has a link prop, so clicking it will navigate to the homepage (/).</p>
</li>
<li><p>The second and third MenuItem components are simple text items without links.</p>
</li>
</ul>
<p>The <code>badge="true"</code> prop can be used to indicate a badge or notification on the MenuItem, and the <code>isSelected={true}</code> prop marks this menu item as currently selected or active. You can customize this feature according to your needs.</p>
<h3 id="heading-step-7-add-submenus-optional">Step 7: Add Submenus (Optional)</h3>
<p>To add submenus inside the main menu, you can use the Submenu component. The Submenu can be nested inside the Menu component and contains its own set of MenuItems. Use the title prop to set the submenu heading</p>
<p>Here’s an example of adding a submenu:</p>
<pre><code class="lang-javascript">&lt;Sidebar width={<span class="hljs-string">"270px"</span>}&gt;
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">Menu</span> <span class="hljs-attr">subHeading</span>=<span class="hljs-string">"SERVICES"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">MenuItem</span>  <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span>   <span class="hljs-attr">link</span>=<span class="hljs-string">"/web-development"</span>&gt;</span>Web Development<span class="hljs-tag">&lt;/<span class="hljs-name">MenuItem</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">MenuItem</span>   <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span>  <span class="hljs-attr">link</span>=<span class="hljs-string">"/seo-services"</span>&gt;</span>SEO Services<span class="hljs-tag">&lt;/<span class="hljs-name">MenuItem</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">Submenu</span> <span class="hljs-attr">title</span>=<span class="hljs-string">"Marketing"</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">MenuItem</span>  <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span>  <span class="hljs-attr">link</span>=<span class="hljs-string">"/digital-marketing"</span>&gt;</span>Digital Marketing<span class="hljs-tag">&lt;/<span class="hljs-name">MenuItem</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">MenuItem</span>  <span class="hljs-attr">component</span>=<span class="hljs-string">{Link}</span>  <span class="hljs-attr">link</span>=<span class="hljs-string">"/content-marketing"</span>&gt;</span>Content Marketing<span class="hljs-tag">&lt;/<span class="hljs-name">MenuItem</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">Submenu</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">Menu</span>&gt;</span></span>
&lt;/Sidebar&gt;
</code></pre>
<p>In this example:</p>
<ul>
<li><p>A submenu under the "Marketing" heading is added inside the "SERVICES" menu.</p>
</li>
<li><p>The submenu contains two MenuItems with links to different service pages.</p>
</li>
</ul>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>You have now successfully integrated a fully functional sidebar in your React and Next.js application using react-mui-sidebar. You can further customize the sidebar by:</p>
<ul>
<li><p>Modifying the width and design.</p>
</li>
<li><p>Adding more submenus, menu items, or icons.</p>
</li>
<li><p>Using links to navigate between pages.</p>
</li>
</ul>
<p>This setup provides a flexible, responsive, and easy-to-use sidebar, which is perfect for most web applications.</p>
<h3 id="heading-try-it-out">Try It Out:</h3>
<p>You can view the working demo of the react-mui-sidebar here: <a target="_blank" href="https://react-mui-sidebar.vercel.app/"><strong>View Demo</strong></a><strong>.</strong></p>
<p><strong>Note:</strong> in this tutorial, we utilized <a target="_blank" href="https://mui.com/material-ui/material-icons/">Material UI Icons</a> to construct this sidebar. Feel free to choose an alternative library or use different icons based on your specific requirements.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
