-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Components: display a chevron icon in Item
#36653
Comments
Hey @griffbrad @mirka @diegohaz @jasmussen @mtias , could you please have a look at this issue and share your thoughts? In the meantime, I've also opened #36654 to illustrate Approach 1 Thank you! |
I'm leaning toward Approach 1 for now, and have a heavy reluctance for Approach 2. When we are ready to commit to some specific usage patterns, I think higher-level components like Approach 3 are the way to go. By that point we'll have a better idea of what consumers need, or are struggling with. The "accessory" naming is interesting. I like how generic it is, but it's also worth noting that we already have some components that use the terms "prefix" and "suffix" to denote things like these. |
I also personally agree with @mirka . I also personally prefer Approach 1 over Approach 2. I personally like the simplicity of the I like Approach 3 too, but we'd need to first get a good feeling for the right balance to strike when creating higher-level components.
This is great feedback. Adopting coherent naming conventions is going to be very important. |
Update: The PR illustrating Approach 1 has been merged. This doesn't preclude us from iterating with other approaches later on (especially with the higher-order components proposed in Approach 3). |
There are a few ways we could go about displaying a chevron icon in the
Item
component.Currently, the
Item
component is a very generic and un-opinionated component, that doesn't care about its content — this makes it highly composable and reusable across many interfaces. We need to make sure that, whatever approach we end up taking, we don't make theItem
component too opinionated or specific towards one use case.Approaches
I though about a few approaches that we could take:
Approach 1: More Storybook examples
We could add a few more examples in Storybook, without touching the component's source code (approach taken in #36654 )
This approach has the advantage of leaving the
Item
component as-is, keeping it simple. Any developer in need of displaying a chevron icon could copy that example and use it in their own app.Approach 2: Add functionality to
<Item />
Another approach would be to make changes to the
Item
's component itself. We could borrow from UIKit'sUITableViewCell
and introduce the concept of Accessory Views, and allow each item to have a "start" and an "end" accessory view.This would definitely help "normalising" the UI/UX around this scenario, but would leave more questions open:
Approach 3: create a new, higher-level component
Finally, as an alternative to modifying the
Item
component directly, we should consider creating and exporting a new, more specialised component build on top ofItem
.We would need to decide:
ItemGroup
andItem
? And what should it be called?Other considerations
The pattern that we decide to adopt here may also inform future decisions about how to best add high-level functionality to a component.
The text was updated successfully, but these errors were encountered: