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

Expose the AutoComplete Option Label #3665

Open
AndreasPresthammer opened this issue Oct 29, 2024 · 2 comments
Open

Expose the AutoComplete Option Label #3665

AndreasPresthammer opened this issue Oct 29, 2024 · 2 comments

Comments

@AndreasPresthammer
Copy link

Is your feature request related to a problem? Please describe.

My primary goal to disable certain options, and also apply a Popover (https://storybook.eds.equinor.com/?path=/docs/data-display-popover--docs) to the disabled elements. We want the Popover to explain to the end user why the option is disabled.

The disabling part works fine using the AutoComplete.optionDisabled-prop. On the other hand, to apply the Popover on the disabled options we were thinking to make use of the AutoComplete.optionComponent-prop to provide a custom option that uses the Popover. Naively this works fine, but the problem is that the default option Label component has a bunch of styling that we would really want to retain on our slighty modified Option-component. The mentioned Label is not exposed, so we cannot wrap it in our optionComponent-code.

Describe the solution you'd like

We would like the Autocomplete Option Label component (https://github.com/equinor/design-system/blob/develop/packages/eds-core-react/src/components/Autocomplete/Option.tsx#L44) to be exported, such that we can wrap it in our Popover, but still retain the default Autocomplete styling (that you maintain).

Describe alternatives you've considered

Alternatively you could consider providing other ways we can achieve our described goals of explaining to the end user why an option is disabled.

An alternative approach for us to get the behavior we want is also to duplicate the code here https://github.com/equinor/design-system/blob/develop/packages/eds-core-react/src/components/Autocomplete/Option.tsx#L44 over into our own app, but we would rather try to avoid that.

@AndreasPresthammer
Copy link
Author

Any feedback on this?

@oddvernes
Copy link
Collaborator

I can perhaps take a look at this soon, we have been a bit busy lately 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants