-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Create a Chakra Select
component
#8630
Comments
This issue is stale because it has been open 45 days with no activity. |
This issue is stale because it has been open 45 days with no activity. |
@pettinarip you requested I continue the conversation here about the use of ZagJS to create a custom select for properly handling the styling from the new DS. I would argue for the use of Zag over react-select. If I'm not mistaken, the bundle size is smaller unless react-select is tree-shakeable DISCLAIMER: I've not looked far enough into this yet to conclude otherwise. |
Currently I see that we have 2 type of selects/dropdowns: 1. StyledSelect
In neither of them, we are using complex logic (autocomplete, multiselection, etc), just the basic native select features. 2. ButtonDropdown My biggest concern is related to the amount and size of the libs that we are adding. I was trying to think if there was a way we could simplify these two given that the features we require for them are practically none. In my mind, I have these two ideas:
Comparing sizes:
|
@pettinarip I think downshift can be considered here, keeping aria patterns in mind. Threw together a CSB comparing Zag and Downshift select implementation. Basically took the Zag structure I already made and replace the machine logic with the logic from downshift's To make it easier to view from dev tools, here is the Zag example content elements that are in a portal. (What it looks like on my end in Firefox) Wouldn't the different lib sizes in development be smaller than what you listed since they all are tree-shakeable? |
Jumping into the mix now. Help me understand why we can´t use the chakra default. @pettinarip, you divide them into two types of select My take: Am I missing anything here? |
[replying to myself] Using the chakra default, we lose the ability to "type to filter", correct? |
@nloureiro I'm thinking of the styling first. And the native select (or using Chakra's select component) does not give you the flexibility to style the dropdown container around the options and you wouldn't be able to do the styling you have the new DS.
As to a filter feature, there is not one for this type of dropdown in Chakra. This type is being referred to as a |
When we speak of the chakra one, is this one? right? |
@nloureiro Correct! |
Awesome @TylerAPfledderer! looks great in the codesandbox.
Couldn't follow you on this. Why did you share that image? to see the aria attrs generated by Zag?
Hmm...not sure. Perhaps. However, I don't think there will be that much to "shake" from these libs since they are pretty small and very focused on just one thing. |
Do you mean that we will not use |
Yes, to identify the attributes applied from Zag versus the attributes applied from downshift in the similar structure. Since the Zag version of the options list sits in a portal, I figure I would provide the screenshot to easily show it. 😁 |
|
Ok, an update on this front. Talking with @nloureiro we were converging on the idea of using the Chakra UI components as much as we can. Having said that, in order to reduce the number of libs we currently have, is to do the following:
With this approach, we will be able to remove the @TylerAPfledderer what do you think about this? I'm sorry for not catching this before you did all the work on the codesandboxes 🙏🏼 |
@pettinarip For the Select, what will be lost is the design from the DS when the options are visible. (Is that what you meant by customize?) |
Correct |
@pettinarip That's good for me! If you haven't noticed yet, I do have a PR up in draft for the form components. Would you want a custom Select component to house logic and handle the listing of options and their data? Or just create the theming and a story file? |
@TylerAPfledderer Cool, thanks!
Nice! I've seen the PR created but haven't reviewed it yet.
Not sure if you've detected a specific case where we have special logic around the selects we have. I haven't. Since we don't need anything special, lets just create the theme for the Chakra Select. |
@pettinarip I did not replace the instances of After viewing this logic again, it seems that a custom component would be helpful in place of Instances: Were you looking to simplify the current logic? |
Ok, so you have implemented the new styles on the Chakra Select but not replaced it on the codebase. That fine 👍🏼 In terms of abstracting that logic I'm ok as well. Do you have in mind creating a new folder under
Wasn't thinking about doing that tbh but if that helps us to keep things easier to use, then lets do it. |
@pettinarip yes. I could try and leave the logic passed to the component in each page as is and then in this new |
@TylerAPfledderer perfect. Yea, that sounds great. |
Select
component using react-select
Select
component
This is part of our 2nd wave of migration of the Implement UI library epic.
Is your feature request related to a problem? Please describe.
Right now we have a
Select
component that is styled using styled components and usesreact-select
.Describe the solution you'd like
Create a new component calledSelect
undersrc/components
that is wrapped and styled using Chakra.Additional context
Be aware of this: there are cases where we are adding more styles to the base styles of the Select.
FindWallet
The text was updated successfully, but these errors were encountered: