Customize the appearance of a React tab to eliminate the border on the bottom

When it comes to styling material tabs, I've managed to customize them by creating a theme and overriding the defaults like this:

MuiTab: {
  styleOverrides: {
    root: {
      textTransform: 'capitalize', // Set textTransform to capitalize,
      fontWeight: 600,
      '& .MuiAvatar-root': {
        width: 72,
        height: 'auto',
        marginBottom: 6,
      },
      '&.Mui-selected': {
        borderTop: `2px solid ${COLORS.PrimaryMedDark}`,
        borderLeft: `1px solid ${COLORS.BorderGray}`,
        borderRight: `1px solid ${COLORS.BorderGray}`,
        borderBottom: 'none',
        color: COLORS.PrimaryMedDark,
        '.MuiAvatar-img': {
          //border: ' 2px solid #FFC44D !important',
        },
      },
      '& .MuiIconButton-root': {
        padding: 0,
        backgroundColor: COLORS.White,
      },
    },
  },
},

I have successfully added left, right, and top borders to the selected tab.

https://i.sstatic.net/20sCCdM6.png

However, despite everything else working as intended, the bottom border is proving difficult to remove by any means.

In my search for a solution, I came across a method to tailor tabs with custom designs:

https://mui.com/base-ui/react-tabs/

Although effective, this approach seems overly intricate for my needs since I can achieve everything except for removing the bottom border through existing styles.

Is resorting to a custom-style component as suggested in the aforementioned link the only path to solving this issue, or is there a way to address it within the constraints of the current tab structure?

Update

My attempt at setting a border bottom on '&.Mui-selected' using borderBottom: '5px solid red',, yielded this result:

https://i.sstatic.net/MX9aHRpB.png

The blue line you see is not part of the selected Tab element, as evidenced by the red border applied to the selected tab appearing above it. This default blue border seems to originate elsewhere, possibly at the parent level, which explains why changing the style of the selected tab doesn't eliminate it. It actually appears with an animation when the tab is selected.

Answer №1

If you give it a shot

outline: none !important; //important remove even if element focus

I cannot guarantee that this will solve the issue for you.

In reality, the border could be generated by either outline or border, and occasionally by pseudo-elements such as ::after or ::before. Please examine all scenarios carefully.

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

What is the best way to access a reference to the xgrid component in @material-ui?

Is there a way to obtain a global reference to the xgrid component in order to interact with it from other parts of the page? The current code snippet only returns a reference tied to the html div tag it is used in, and does not allow access to the compo ...

Access denied to files uploaded to S3

Recently, I was working on developing a nodejs api to upload files to my AWS s3 bucket. I followed some online tutorials and used the code snippet provided below. Surprisingly, when I tried to open the uploaded files (images/word/pdf), they either did not ...

Activate the 'li' element within the 'ul' whenever a 'ui-sref' link on the

I have been working on building a dashboard that consists of an abstract state called dashboard, with subdashboard as the immediate child state. https://i.sstatic.net/YTHky.png Previously, clicking on user details would take the user to the dashboard.tab ...

Using React to map and filter nested arrays while also removing duplicates

Hello, I recently started working with react and I've encountered a challenge while trying to map an array. const fullMen = LocationMenuStore.menuItems['menu']['headings'].map((headings: any) => { <Typography>{ ...

What are some ways I can customize the appearance of a Bootstrap 5 Navbar specifically when it is in the collapsed

Currently utilizing Bootstrap 5, my goal is to align the Navbar social icons to the left when the navbar is collapsed for small/mobile devices, and to the right when viewed on a larger screen. Can you assist in identifying which selectors need styling for ...

What is the best way to enlarge a navbar from the top using Bootstrap 5?

I have a button labeled "MENU" at the top and a logo image below it. Currently, the menu expands from the bottom of the button. I would like it to expand from the top instead, and when the menu is expanded, the button should be under the navigation list, n ...

Triggering the creation of an Algolia Index from Firestore operations like updates, deletions, and additions is causing significant delays

I'm currently developing an application with Algolia integration and Firebase compatibility. To utilize Algolia's features, I have incorporated the firebase extension from this link. This allows for real-time synchronization of data between Fire ...

What specific CSS selector should be targeted in order to modify the appearance of this button?

I'm attempting to alter the appearance of a button within my Wordpress site, but I've hit a roadblock in identifying the correct element to modify. So far, I've tried targeting: .input#chained-quiz-action-1, however, the button stubbornly re ...

Inadequate handling of the react-router replace function causing issues

I am currently using an onEnter hook that calls the following function: function (nextState, replace) { var unsubscribe = firebase.auth().onAuthStateChanged(function (user) { if (!user) { console.log('attempting to access a se ...

Is there a way to configure Rails to accept either a nested object or an empty array for a specific attribute?

Abridged Question How can I configure my Rails params to allow for an empty array or a nested object for the same attribute when handling a PUT request? I am unable to share actual code due to confidentiality reasons, so any code snippets provided are si ...

Ways to position a navigation item on the right side of a navigation bar

Seeking guidance on how to align my navigation items in a specific position. I would like my brand name to appear on the left side and the login button on the right end of the navbar. As a newcomer to bootstrap, I am in need of assistance with this issue. ...

I am looking for a way to retrieve the ids of all div elements that have the same x coordinate using document.elementFromPoint in JavaScript. Can someone help me with

Currently, I am facing an issue where I have two divs positioned at the same x coordinate. I am attempting to retrieve the IDs of both divs using document.elementFromPoint(). However, I am only able to receive the ID of one div. var elem = document.elem ...

What is the best way to create a variable in a React component that requires asynchronously loaded data in order to be functional?

While I have a good understanding of passing data from one component to another using this.props, I am encountering difficulty in asynchronously fetching and storing values, such as from a database, that need to be accessed throughout the component. The ch ...

Is it possible to conceal the text specifically inside a textarea, rather than just hiding the entire textarea itself?

Is it possible to have a button next to the textarea that allows you to hide and unhide the text inside the textarea by clicking on it? ...

Attempting to assign the object retrieved from the interface as the new value for window.location.href

I encountered an issue where the error message Type MyInterface' is not assignable to type 'string' popped up. Although I comprehend the problem, finding a suitable solution has proven to be challenging. MyInterface solely returns one item, ...

When running the command "npm start," an error occurs stating: Plugin/Preset files are prohibited from exporting objects and can only export functions

I recently started using reactJS and was following a tutorial. However, I encountered an error when trying to run "npm start". Here is the error message: ERROR in ./main.js Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Plugin ...

The implementation of the "setValue" function from react-hook-form resulted in the generation of over 358,000 TypeScript diagnostics for various types

In my experience, I have frequently used react-hook-forms and `setValue` in various parts of my application without encountering any issues. However, I recently came across a problem while compiling in a newly created branch based on the main branch. Desp ...

Issue resolved: Mysterious fix found for background images not displaying in NextJS React components

I am having trouble displaying a background image on an element in NextJs using Typescript and Tailwind. I do not believe it is a TypeScript issue since I am not receiving any errors or IntelliSense warnings. Below is the code I am working with: var classn ...

The alignment of divs on the right side is off-kilter after removing margins from the middle columns

While utilizing the Blueprint CSS framework, I encountered a challenge with removing the margins between columns. Removing these margins caused an issue where a div spanning all columns appeared wider than the combined width of the divs on rows where margi ...

The Array map function is not displaying the list within a React component that is based on a Class

I am having trouble displaying a list of food items in my Parent component FoodBox.js and its child component FoodItems.js. I am using the map() method, but the <ul> element is showing up empty. Here is my code for FoodBox.js const FOOD_ITEMS = [ { ...