mui / mui/material-ui

[text field] Remove space before asterisk or make FormLabel asterisk value customisable

Open
#26,341 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

design: material has workaround scope: text field
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

  • I have searched the issues of this repository and believe that this is not a duplicate.

Possibly related to https://github.com/mui-org/material-ui/issues/22538

Summary 💡

Currently when a <TextField /> has required={true} an asterisk is automatically added to the child FormLabel behind the scenes. This is the desired outcome and is great, but, I have noticed that an &nbsp; is also added along with the asterisk resulting in something like this
First Name *

My team and I would like to keep the asterisk but not the &nbsp; to give a final result of
First Name*

I've searched the docs and cannot find a way to change this.

Also looking at the Material Design documentation it appears that having a space before the asterisk is not desired so perhaps this needs updating? https://material.io/components/text-fields#anatomy

Thanks in advance on any advice about what could be done to resolve this.

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.

Research direction

Start by tracing how TextField passes required state to its child FormLabel, then review the related issue and Material Design text-field guidance linked in the report. Done means the required asterisk remains while the unwanted space can be removed or the FormLabel asterisk value can be customized.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.