mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.35k stars 32.13k forks source link

[material-ui][OutlinedInput] Theme options `ownerState` does not contain correct values #42333

Open Crownie88 opened 3 months ago

Crownie88 commented 3 months ago

Steps to reproduce

Link to live example: (required)

Steps: 1. 2. 3.

Current behavior

I have an TextField with required set to true. When styling the MuiOutlinedInput I want conditional styling when the element is required but the ownerstate.required is not set to true.

However, when im styling MuiFormControl .MuiInputBase-root fieldset:first-of-type the ownerstate does contain the right information.

Expected behavior

I expect the MuiOutlinedInput to contain the correct ownerstates since this is the control where i actually set the "required" attribute.

Context

Conditional styling in my theme options

Your environment

npx @mui/envinfo ``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```

Search keywords: required ownerstate themeoptions

danilo-leal commented 3 months ago

Hey, thanks for opening the issue! Could you provide a minimal reproduction? It helps us troubleshoot. A live example would be perfect. This StackBlitz sandbox template may be a good starting point.