Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown: emptyMessage prop doesn't work #6671

Closed
ivanpajon opened this issue May 25, 2024 · 0 comments · Fixed by #6672
Closed

Dropdown: emptyMessage prop doesn't work #6671

ivanpajon opened this issue May 25, 2024 · 0 comments · Fixed by #6672
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@ivanpajon
Copy link
Contributor

Describe the bug

Using a Dropdown with unstyled mode shows a 'empty' label when no option is selected. Prop 'emptyMessage' to customize that message doesn't work.

<Dropdown
  id="gender"
  name="gender"
  value={gender}
  onChange={e => setGender(e.target.value)}
  options={genders}
  emptyMessage="Selecciona una opción"
  unstyled
/>

error_1
error_2

Also, as I'm using the dropdown with a float label, both 'empty' label and my defined float label they overlap each other.

<span className="p-float-label">
  <Dropdown
    id="gender"
    name="gender"
    value={gender}
    onChange={e => setGender(e.target.value)}
    options={genders}
    emptyMessage="Selecciona una opción"
    unstyled
  />
  <label htmlFor="gender">Género *</label>
</span>

error_3

Reproducer

No response

PrimeReact version

10.6.6

React version

18.x

Language

TypeScript

Build / Runtime

Next.js

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

If I don't use emptyMessage prop it shouldn't show any label.
And if I define emptyMessage prop it should show that label.

@ivanpajon ivanpajon added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 25, 2024
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels May 26, 2024
@melloware melloware added this to the 10.7.0 milestone May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants