The issue of text decoration not applying to MUI list items

I've been using mui lists to set up a sidebar.

 <List>
          <StyledLink to="/">
            <ListItem disablePadding>
              <ListItemButton>
                <ListItemIcon>
                  <GridView />
                </ListItemIcon>
                <ListItemText primary="Dashboard" />
              </ListItemButton>
            </ListItem>
          </StyledLink>
 </List>

I attempted to create a custom Link like this,

import { Link } from "react-router-dom";

const StyledLink = ({ to, style = {}, children }) => (
  <Link to={to} style={{ ...style, textDecoration: "none" }}>
    {children}
  </Link>
);

export default StyledLink;

I also looked into this solution.

However, despite my efforts, the blue color persists and it fails to adopt the mui list item text formatting.

Answer №1

text-decoration: "none"
solely eliminates the underline effect. To remove the blue color, adjust the color attribute.

style={{ ...style, textDecoration: "none", color: "inherit" }}

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

Using React Material UI icon within an auto complete feature

https://i.stack.imgur.com/W3CmF.png I am struggling to incorporate the target icon into the autoComplete component. After reviewing the documentation, I have been unable to find a solution. In TextInput, a similar outcome can be achieved by implementing ...

Guide to displaying Content components beneath the AppBar in Material-UI version 5

My current project involves creating an app bar with the app bar component from MUI v5. However, I have encountered a problem where another content component overlaps with the app bar. In MUI v4, I was able to resolve this issue using theme.mixins.toolba ...

What causes a standard React component with a default render prop to not pass PropTypes validation successfully?

I'm currently working on a React component with a render-prop that has a generic type. To improve usability, I want to set a default value for the render-prop. The code is functioning correctly, but during type-checking, I encountered a warning regard ...

What methods can be used to stop events in a resource timeline from overlapping?

I am facing an issue with the calendar display when dealing with events that have weekly intervals. The problem occurs when the slot duration is also weekly and doesn't align perfectly, resulting in a "zig-zag" pattern in the calendar: https://i.stac ...

Having trouble importing AutoComplete from material UI@next package

What is the process for importing AutoComplete in the most recent version (V1.0.0-beta.26) of Material-UI? ...

Tips for organizing JSON information in ReactJS

Could someone lend a hand with sorting JSON data in ReactJs? I'm having trouble getting it to work properly. Also, if I want to sort by title, would it be the same process? Thanks! This is what I've tried so far: componentDidMount() { ...

The integration of lodash debounce with a NextJS function is failing with the error message "[TypeError: search(...) is undefined]

I've been developing a feature in NextJS that allows users to search for YouTube videos based on their input. In order to optimize API calls, I decided to implement lodash debounce with the useCallback hook. However, I'm encountering an issue whe ...

Issue with Material UI react select: the selected value does not clear when backspacing

When an option is selected from the dropdown, the value does not clear when pressing backspace. Click here to view the code. Any assistance would be greatly appreciated! ...

Toggle the state of a Material UI checkbox in ReactJS based on the data from hooks that return a true or checked value

I need assistance with checking/unchecking a checkbox value in an edit modal based on the return of addAdvisory(hooks) which is 'Y', indicating true/checked. Below is my basic code snippet: const [addAdvisory, setaddAdvisory] = useState({ SY ...

Introducing Block Insert feature in React Draft-js - a powerful

How the Process Works: Upon hitting the spacebar, the Draft-JS editor queries the text content for a specific word. Subsequently, all instances of that word are enveloped in tags. The HTML is then converted back and the state of the Draft-JS editor is upd ...

What are the steps to resolving an issue with importing a css file in next.js?

Error: ./node_modules/quill-emoji/dist/quill-emoji.css ModuleParseError: Module parse failed: Unexpected character '�' (1:0) You may need a suitable loader for handling this file type, as there are currently no configured loaders to process it. ...

Why doesn't Material-UI seem to understand the theme.spacing function?

Issue with Material-UI's theme.spacing function I've encountered a problem while using Material-UI's theme.spacing function in a React application. It seems that the spacing function is not being recognized. The Javascript error message st ...

Choose properties in the Textfield component of material-ui

My Textfield has a bug, how can I ensure that my Maps label is in the center of the dropdown every time and not elevated at the top left corner? Thank you! Check out this screenshot for reference <TextField select ...

Create a personalized message for the DeleteWithConfirmButton component in react-admin

Is there a way to send my message to DeleteWithConfirmButton only for one specific instance, not globally? If I want to change the message globally, I can do it like this: const messages = { en: { ra: { message: { delete_contents: &apo ...

Steps to insert a new row for a grid item using material-ui

When it comes to breaking a line of grid item like this, the image shown below illustrates how the rest space of the grid should be empty. https://i.stack.imgur.com/pvSwo.png <Grid container spacing={3} <Grid item xs={12}> "Grid Item xs ...

Is there a way to restrict the number of words displayed in React? Check out this code snippet: `<ProductImg imgtext={products.description}/>`

imgAlt={product.name} Note: Consider the product name as: HD Single Sided Cantilever Rack. In this case, only HD Single Sided... should be displayed Please find the code snippet below <ProductImg imgtext={products.description}/> ...

How can one destructure deeply nested props within a constructor in React?

Within my class component, I am encountering an issue with the constructor: constructor(props) { super(props); this.state = { dirty: this.props.form.dirty // error occurs here! }; } The linting tool eslint is indicating an error relate ...

Higher order components enhance generic components

I'm facing an issue where I want to assign a generic type to my React component props, but the type information gets lost when I wrap it in a higher order component (material-ui). How can I ensure that the required information is passed along? type P ...

Issue with Filtering Functionality in Material Ui Autocomplete Component

I am working on an Autocomplete feature where I pass an array of fetched and predefined options. You can check out the code here: https://codesandbox.io/s/geocoding-demo-forked-2f189?file=/src/App.js However, I encountered an issue when typing "Diestsestr ...

Tips for triggering several functions with a single onClick event in React?

I am currently working on a React Project where I have defined several functions to set conditions for rendering components on the page. However, I now need to be able to call all these functions again within the components when a button is clicked, in ord ...