Skip to content

fix(react-components/text-field): console error - Expected a valid label or labelledby attribute, received none. If you want to hide the label, provide both label and hide-label attributes #500

Closed
@malikarami

Description

@malikarami

Describe the bug

Since the label and hideLabel props are optional, this error should be handled automatically.

[TAPSI][text-field]: Expected a valid `label` or `labelledby` attribute, received none. If you want to hide the label, provide both `label` and `hide-label` attributes.

To Reproduce Steps to reproduce the behavior:

 <TextField
            placeholder="شماره همراه"
            type="tel"
            value={phoneNumber}
            onChange={(e) => setPhoneNumber((e.target as HTMLInputElement).value)}
            hideLabel
            label=""
          />

or

 <TextField
            placeholder="شماره همراه"
            type="tel"
            value={phoneNumber}
            onChange={(e) => setPhoneNumber((e.target as HTMLInputElement).value)}
          />

Expected behavior
This error should not be logged to the console.

Screenshots

Screen.Recording.2025-05-31.at.7.12.13.PM.mov

Desktop (please complete the following information):

  • OS: [e.g. iOS]: MacOS 14
  • Browser [e.g. chrome, safari]: Chrome
  • Version [e.g. 22]: 0.17.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions