I am trying to incorporate the tailwind styling of "active:border-b-2 active:border-blue-500" into my next.js project, but unfortunately, it doesn't seem to be

This is the custom Tailwind CSS styling I would like to apply:

import React from 'react'

function HeaderIcon({Icon}) {
  return (
    <div
      className="flex
      items-center
      cursor-pointer
      md:px-10
      sm:h-14
      md:hover:bg-gray-100
      rounded-xl
      active:border-b-2
      active:border-blue-500"
    >
      <Icon className="h-5" />
    </div>
  )
}

export default HeaderIcon

Below is where the custom Tailwind style will be added:

<div className="flex justify-center flex-grow">
  <div className="flex space-x-6 md:space-2">
    <HeaderIcon Icon={HomeIcon} />
    <HeaderIcon Icon={FlagIcon} />
    <HeaderIcon Icon={PlayIcon} />
    <HeaderIcon Icon={ShoppingCartIcon} />
    <HeaderIcon Icon={UserGroupIcon} />
  </div>
</div>

Answer №1

To activate the active status, you will need to adjust the Tailwind configuration settings.

Check out the documentation for more information.

// tailwind.config.js
module.exports = {
  // ...
  variants: {
    extend: {
      backgroundColor: ['active'],
    }
  },
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue encountered while retrieving information from JSON structure

My data is stored in a JSON file named info.json. [ {"employee": {"name":"A", "salary": "324423"}}, {"employee": {"name":"B", "salary": "43111"}}, {"employee": {"name":"C", "salary": "43434"}}, {"employee": {"name":"D", "s ...

What are the steps to perform an unsecured fetch from a Next.js API handler?

Currently, I am faced with a challenge in my Next.js app which needs to communicate with an outdated microservice lacking TLS. To bypass this limitation, I implemented an API handler to interact with the microservice over HTTP. However, when attempting to ...

How can I retrieve text within a p tag using xpath and xpath axes?

<div class="details"> <p><b>Compatibility:</b> All versions</p> <p><b>Category:</b> Entertainment</p> <p><b>Updated:</b> Apr 2, 2014</p> <p><b>Version ...

Sorting a parent array in AngularJS using a child array's Date field as the basis

I have an array of arrays of objects with the following structure: parentArray = [ [{id:1, date:1505020200000}, {id:4, date:1505020200000 }], [{id:2, date:1504681500000}], [{id:3, date:1504671000000}, {id:20, date:1504671000000}] ] Each nested array cont ...

What causes RangeError: Maximum call stack size exceeded when Element UI event handlers are triggered?

I'm currently working on setting up a form and validating it with Element UI. Despite closely following the documentation, I am encountering an issue where clicking or typing into the input boxes triggers a RangeError: Maximum call stack size exceeded ...

Printing an array from JavaScript to an EJS template: Tips and Tricks

I'm currently working on a database-driven website that focuses on searching through people's profiles. When attempting to display information from a database query, I am encountering the issue of receiving [object Object]. Below are snippets o ...

Ways to stop the default action in a confirm dialog while using Angular JS

Within my save function, I have the following: $scope.saveData = function () { if (confirm("Are you sure you want to save") === false) { return } // do saving When using the above code and clicking "yes," I encounter an error. Interestin ...

Even though my performance in a sandbox environment is excellent, I am unable to obtain a token in a production environment

After posting my question on the Evernote developer forum, I was disappointed to find that the forum had been closed before I received a response. Even after receiving a proposal from an Evernote employee named chanatx to verify if my key was activated co ...

AJAX response for form validation

I need to validate my contact form when the submit button is clicked. If all fields are valid, I want to display a Processing message using AJAX, followed by a success message with the entered name. The content of my Form is: <form onsubmit="return va ...

Conceal a div and label after a delay of 5 seconds with a JavaScript/jQuery function in C#

Here is a sample div: <div class="alert alert-success alert-dismissable" runat="server" visible="false" id="lblmsgid"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> ...

Implement the click event binding using classes in Angular 2

If I have the template below, how can I use TypeScript to bind a click event by class? My goal is to retrieve attributes of the clicked element. <ul> <li id="1" class="selectModal">First</li> <li id="2" class="selectModal">Seco ...

Discovering the overlap between two arrays using Node.js

Question: Simplest code for array intersection in JavaScript In the development of my app using Mongodb and Nodejs, I am working with a 'students' collection that includes an array listing all the courses (course IDs) a specific student has ta ...

Tips for fixing the Runtime.UnhandledPromiseRejection error when deploying your next.js project on Vercel and Netlify

Encountering an error during deployment on Vercel or Netlify. The same error persists on both platforms. Any suggestions on resolving this issue would be greatly appreciated. Snippet of the Database code: import mongoose from 'mongoose'; const ...

Submitting Multi-part forms using JQuery/Ajax and Spring Rest API

Recently, I started exploring JQuery and decided to experiment with asynchronous multipart form uploading. The form includes various data fields along with a file type. On the server side (using Spring), I have set up the code as follows: @RequestMapping ...

Ways to incorporate design elements for transitioning focus between different elements

When focusing on an element, I am using spatialNavigation with the following code: in index.html <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfb5acf2acafbeabb6beb3f2b1bea9b6 ...

onload function prevents further URL redirection

After submitting the form "View this product," a function is triggered to retrieve the product id from the form data. Although I can successfully obtain the form_data, the page does not redirect as expected. I suspect that my function may not have been pr ...

Trouble with CSS Positioning: Resizing my browser causes my image to shift in position

Upon resizing the browser window, my website layout adjusts accordingly and looks as intended at a smaller size: However, as I begin to expand the browser width, the centrally positioned image starts shifting towards the left. I aim for the image to remai ...

What is the reason behind the auth() function in Auth.js returning a null user object?

Utilizing Auth.js credentials provider for user sign-ins in a Next.js application has proven successful. The auth() function now returns a non-null object upon signing in, as opposed to returning null previously. // when not signed in const session = await ...

Unable to open new tab using target _blank in React js production build

After attempting to access the link, a 404 error appeared in the live version of react js and triggered an error on the firebase hosting platform. <Link target='_blank' to={'/property-details?id='some_id'}/> ...

Guide to implementing onhashchange with dynamic elements

Hey there! I've encountered a problem with two select boxes on my webpage, each in different anchors (one on the page, the other in an iframe). What I'm trying to achieve is for the code to recognize which anchor it's in and then pass the se ...