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: Allow control of dropdownIcon based on state #5308

Closed
melloware opened this issue Nov 13, 2023 · 0 comments · Fixed by #5309
Closed

Dropdown: Allow control of dropdownIcon based on state #5308

melloware opened this issue Nov 13, 2023 · 0 comments · Fixed by #5309
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@melloware
Copy link
Member

melloware commented Nov 13, 2023

From Discord:

Hi, in a Dropdown, I'd like to use a different 'dropdownIcon' depending on its state, i.e. when the options panel is open. I found the type DropdownState, which seems to contain this information in 'overlayVisible', but I have no idea how to access that. is there a way, to catch the state change in a callback?

<Dropdown
       dropdownIcon={(opts) => {
            return opts.iconProps.overlayVisibleState ? <StarIcon {...opts.iconProps} /> : <CheckIcon {...opts.iconProps} />;
       }}
       value={selectedCity}
       onChange={(e) => setSelectedCity(e.value)}
     options={cities}
      optionLabel="name"
      placeholder="Select a City"
      className="w-full md:w-14rem"
/>

Its missing overlayVisibleState

@melloware melloware self-assigned this Nov 13, 2023
@melloware melloware added the Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add label Nov 13, 2023
@melloware melloware added this to the 10.0.10 milestone Nov 13, 2023
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 13, 2023
@melloware melloware removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 13, 2023
melloware added a commit to melloware/primereact that referenced this issue Nov 13, 2023
gucal added a commit that referenced this issue Nov 14, 2023
Fix #5308: Dropdown icon pass overlay visible state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant