When to use the MUI ‘sx’ Prop, Styled API, or Theme Override

Material-UI offers several different APIs or systems for styling components. It can be difficult to know which is the right to use from a clean code perspective. In this post I will explain the similarities and differences between sx, styled, and theme overrides in MUI. Here’s an important point: all three styling options can accomplish … Read more

How to Disable MUI Dialog Backdrop Clicks

The Material-UI Dialog component is composed of several MUI components, including a Backdrop. The Backdrop obscures the rest of the screen and prevents user interaction with other UI elements. By default, MUI closes the Dialog if the Backdrop is clicked. If you need to force the user to interact with the Dialog, you don’t want … Read more

How to Make a MUI Horizontal Line Divider (Custom Thickness and Width)

Material-UI has a useful divider component for separating list items, divs, or any other element. The divider visually appears as a horizontal line separator. We can customize the thickness and width of this line with a few CSS values. I started with this example from the MUI docs and then styled the horizontal dividers. The … Read more

How to Set MUI TextField Text Alignment, Text Color, and Label Color

The Material-UI TextField is composed of several subcomponents which can make styling a challenge. However, these subcomponents provide excellent functionality and customization. In this tutorial I will show exact code for styling the text alignment and color in the TextField. We will target several MUI TextField default classes: I’ll show detailed DOM screenshots and full … Read more