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

[RFC] <Dropdown> should expose a leaner API for styling #241

Open
sahariko opened this issue Oct 7, 2021 · 2 comments
Open

[RFC] <Dropdown> should expose a leaner API for styling #241

sahariko opened this issue Oct 7, 2021 · 2 comments
Labels
RFC An open conversation around a suggestion/idea

Comments

@sahariko
Copy link
Contributor

sahariko commented Oct 7, 2021

What we have now

At the moment, our <Dropdown> component supports a extraStyles prop which is passed pretty directly into the underlying react-select component.

Why is it problematic?

  • Creates coupling between the API we give consumers and our implementation.
  • Makes the component too extendable - consumers can change and potentially mess up our basic styling.
  • Unfocused API, which makes controlling specific properties of the component more difficult than it needs to be. For example, let's say a user wants to control the menu's width; consider the 2 following examples:
<Dropdown
    extraStyles={(baseStyles) => ({ ...baseStyles, menu: (base) => ({ ...base, width: 300 }) })}
/>
<Dropdown menuWidth={300} />

Suggestion

We can create a leaner, more focused (and perhaps intuitive?) API, by giving specific props that affect only the aspects of the component we want to.

@sahariko sahariko added the RFC An open conversation around a suggestion/idea label Oct 7, 2021
@sahariko sahariko added this to the Version 1 milestone Oct 7, 2021
@sahariko sahariko changed the title <Dropdown> should expose a leaner API for styling [RFC] <Dropdown> should expose a leaner API for styling Oct 7, 2021
@orrgottlieb
Copy link
Contributor

@sahariko I like to idea of a more direct API - this will help us migrate (if needed) in the future and will allow us to make sure the look and feel of the component.

I think we need to make sure that this is not too limiting. we can ask in a survey (to the apps community) on how the usage. None the less we should add a description in a story on how to use the extraStyles prop. as it is not clear today

@sahariko
Copy link
Contributor Author

Sounds good to me, and as an initial solution we can look for common use cases (menu width, etc.).

Also, good call on the documentation, I'll open an issue for that 🙂

@orrgottlieb orrgottlieb removed this from the Version 1 milestone Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC An open conversation around a suggestion/idea
Projects
None yet
Development

No branches or pull requests

2 participants