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

Primitive Components for Collection #5270

Open
matuzalemsteles opened this issue Dec 20, 2022 · 1 comment
Open

Primitive Components for Collection #5270

matuzalemsteles opened this issue Dec 20, 2022 · 1 comment
Labels
comp: clay-components Issues related to Clay components. (e.g ClayCard, ClayLabel...) research An issue equivalent to Spike on Jira

Comments

@matuzalemsteles
Copy link
Member

Currently we have some components like DropDown.Group, DropDown.Item, Option for Picker, Autocomplete.Item for Autocomplete, VerticalBar.Panel and VerticalBar.Item for VerticalBar and other similar components that serve the same function in a component that defaults to Collection.

They all have something in common, they are used to render an element in a Collection the difference is that each one has its own different markup. The problem with this is that we end up having many specific components for each component, which can sometimes be a little bad because reuse and composition are different for the developer.

One idea about this is to create two main public components <Item /> and <Group /> that can be used in any Collection composition but the rendering result changes according to its context. Internally we can change what this component will render depending on where it is being used this will help us at least remove more than 6 public components by the two components, this number can be higher because there are more components for apply the Collection pattern #5032.

Some immediate benefits are for example the case at #5265 (comment), where DropDown.Group is the same markup for Picker but when in mobile mode it needs to render otherwise, ideally I didn't want to create yet another component to handle just that in Picker as a Picker.Group, so this issue raises more of a need for this to work internally and improve usability for developers.

The purpose of this issue is to propose an RFC that studies the DX of components that aim to:

  • Improve compositing DX with Collection
  • Improve the learning curve
  • Remove the amount of components with the same pattern
  • Check internal API design to change rendering context according to its parent component
@matuzalemsteles matuzalemsteles added comp: clay-components Issues related to Clay components. (e.g ClayCard, ClayLabel...) research An issue equivalent to Spike on Jira labels Dec 20, 2022
@matuzalemsteles
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: clay-components Issues related to Clay components. (e.g ClayCard, ClayLabel...) research An issue equivalent to Spike on Jira
Projects
None yet
Development

No branches or pull requests

1 participant