Skip to content

[TextField] No state class applied for readonly state #33613

@noobDev31

Description

@noobDev31

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

I am trying to achieve the following permutation of styles with the Material UI TextField -

image

I am trying to remove the border of the input whenever I do readonly:true for the TextField.

But it doesn't take any effect and the reason can be that disabled and readonly are both getting the same CSS class.

Expected behavior 🤔

Readonly and Disabled should have a seperate CSS class so that they can targeted differently.

Sandbox - https://codesandbox.io/s/customizedinputs-demo-material-ui-forked-2unmw9?file=/index.tsx:809-870

Steps to reproduce 🕹

Steps:

1.Please open the following sandbox -
https://codesandbox.io/s/customizedinputs-demo-material-ui-forked-2unmw9?file=/index.tsx:809-870
and try giving the props -

InputProps={{ readOnly: true }}
to the LowCodeTextField component at index.tsx

2.The border doesn't get removed even though I have the class in the ThemeProviderconfig.ts
3.
4.

Context 🔦

No response

Your environment 🌎

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: text fieldChanges related to the text field.type: bugIt doesn't behave as expected.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions