mui / mui/material-ui

[material-ui] Add readOnly prop to all form input elements

Open
#41,143 3 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

scope: select scope: switch scope: text field type: enhancement
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Summary

Make the readOnly attribute available as a first order prop on all input elements like TextField, Switch, Select etc. just like disabled is right now.

Examples

No response

Motivation

Since react-hook-form have started to actually follow the HTML spec disabled input values are undefined on form submit. Instead we are supposed to correctly use the read-only attribute, which make sense thinking about it.

Hence it would be preferable if this prop was available directly on every input element in MUI instead of having to dig down into underlying props which is both less easy on the eye and less easy to find in the documentation.

Bonus points for having some kind of default styling indicating that a read-only element is indeed not mutable.

Search keywords: readonly prop input

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.