React.js doesn't seem to be picking up any CSS files

I recently developed an app and encountered an issue with loading the CSS for a specific part of the template.

The CSS file I am using is named styles.module.css:

.my-page__title {
  font-weight: 300;
  font-size: 48px;
  margin-bottom: 15px;
}

.my-page__description {
  font-size: 14px;
  font-weight: 300;
  margin-bottom: 5px;
}

.my-page__wrapper {
  padding: 7px 10px;
  width: 100%;
  position: relative;
}

Below is the code snippet causing the issue:

<Box className={styles['my-page__wrapper']}>
  <Box className={styles['my-page__title']}>
    Hello!
  </Box>
  <Typography className={styles['my-page__description']}>
    Login to your acc.
  </Typography>
</Box>

The problem lies in the fact that while the classes "my-page__wrapper" and "my-page__title" are properly loaded, the one for "my-page__description" is not recognized, leading to improper text formatting. I have searched for solutions but haven't found any similar issues reported. Can anyone help me identify where my mistake might be?

Answer №1

When utilizing Mui's Typography component, it is important to note that the className prop is not recognized. Instead, you should provide your classes in the form of an object as shown below:

<Typography classes={{
    root: styles['my-page__description']
}}>
    Sign up for exclusive access.
</Typography>

To learn more about customizing and extending Mui class names, refer to the documentation

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 CSS to position a pair of divs containing text and images side by side

Is there a better approach to creating two divs and two pictures without using negative margins, similar to the example shown here? ...

Guide on implementing asyncWithLDProvider from Launch Darkly in your Next.js application

Launch Darkly provides an example (https://github.com/launchdarkly/react-client-sdk/blob/main/examples/async-provider/src/client/index.js) showcasing how to use asyncWithLDProvider in a React project (as shown below). However, I'm struggling to integr ...

Convert JavaScript back into an HTML attribute

Is there a way to include a JavaScript code in an HTML attribute like shown below? <div class="xx" animation="yy" animate-duration="<script>Code goes here<script>" ...> </div> I'm struggling to figure it out, is there a solut ...

The width of each column in this dataset is variable and unknown

I need to organize a varying number of items into columns. The sizes of both the items and container are unknown, as well as how many columns will fit or what width they should be. I want the browser to arrange the items in as many columns as possible with ...

What is the best way to send parameters to a React component?

Currently, I am facing an issue with passing a parameter to my react project that was set up using create-react-app. In the package.json file, the configuration is as follows: "main": "index.js", "scripts": { "start": "webpack-dev-server --open - ...

Design interactive elements such as buttons and input fields inspired by the layout of Google websites

Does anyone know how to achieve the sleek, lightweight buttons and text boxes seen on Google's web pages like Google Search, Google Plus, and Google Play? I am currently using JSP and CSS, but I am open to incorporating jQuery if necessary. Any help w ...

"Encountered issues during compiling: X ERROR found at line 9 in the Header.js file, spanning from characters

An error occurred while compiling the module. The following message was displayed: Module not found: Error: Can't resolve '@mui/icons-material/Search' in 'C:\Users\pande\Documents\slack-clone\src\component ...

Extract the content of a nested JSON object in ReactJS using map function

I am encountering an issue while attempting to map nested JSON data, specifically the error 'Element implicitly has an 'any' type'. The problem arises within the search component at: Object.keys(skills[keyName]).map() Below is the cod ...

If a div is hidden, disregard this particular CSS rule

In my current scenario, I am dealing with 3 distinct divs: - Menu - Header (#rt-top-surround) - Showcase (#rt-showcase) - Main Body content (#rt-mainbody-surround) The Menu is set as 'sticky' with position: fixed. As a result, I have to adjust ...

Calculating the dimensions of a CSS element based on its content

Is there a way to achieve this using only CSS, without needing JavaScript? I am working on a project with a lot of relative and absolute positions, where elements must be centered dynamically without specifying static widths. While I have managed to minimi ...

Adjust webpack configuration in CRA 3.x without the need to eject

Looking to tailor the webpack config in CRA 3.x without having to eject. My goal is to create a custom build output in an external directory. One solution I came across was using the react-app-rewired plugin, but it appears to only work for CRA versions ...

"Exploring the power of Backstage.io's MUI button customization

In order to customize the appearance of buttons on the backstage main panel screens like Components, Create, and API, I have successfully adjusted the rounding corners and font size. However, changing the color of these buttons has proven to be more challe ...

The Bootstrap website appears visually appealing on desktop browsers, but the div elements are failing to display correctly on mobile devices

After using Bootstrap to create a multi-row, multi-column site, I encountered an issue with resizing on mobile devices. The divs misalign, stack on top of each other, content disappears, and images flatten to the point of invisibility. How can I maintain t ...

Having an issue with HTML and JavaScript where the button won't open when pressed. Any help is appreciated

https://jsbin.com/haluhifuqe/edit?html,js,output I'm facing an issue with my HTML & JavaScript code - when I click the button, it doesn't open. Can anyone help me out? <!DOCTYPE html> <html> <head> <meta charset="utf-8 ...

planning to append the author's name to the end of the title using CSS

Here is the HTML code I have: <div class='store_detail-level1'> <span class='book_name'>How To Avoid Climate Disaster</span> <br> <span class='author_name'>Bill Gates</span> < ...

Switch between different react components

When a component is opened, I want all other components to close. Whenever they are clicked, they will display a list. class ParentComponent extends Component{ constructor(props){ super(props) this.state= {...} } render(){ return( ...

How to completely hide the StatusBar in React Native

Is there a way to completely hide the StatusBar, including the big white rectangle at the top, rather than just hiding the text? <StatusBar hidden/> If this code snippet only hides the text and not the entire StatusBar, how can I achieve that? Thank ...

Tips for dividing the WordPress header navigation horizontally using separate PHP files

I am trying to customize my WordPress menu navigation by splitting it into two sections: left and right. I have added the menu function in the "functions.php" file to create the menu from the backend, and the frontend modifications will be done in the "hea ...

Oops! You can only have one parent element in JSX expressions

I'm working on creating a password input box, but I keep encountering an error when integrating it into my JS code. Here's the snippet of my code that includes TailwindCSS: function HomePage() { return ( <div> <p className=&q ...

React.js with Facebook blocked

In the event that Facebook is censored at my current location, making it inaccessible with an error message like ERR_CONNECTION_REFUSED, would I still be able to utilize React.js for coding purposes? Considering that React is developed by Facebook and requ ...