canonical / canonical/react-components

Investigate components composition patterns

Open
#774 1 comment 0 reactions 0 assignees View on GitHub
P3 Triaged Question ❓ Triaged: new architecture
Dominant language
TypeScript
Stars
151
Forks
74
Avg merge
1d 2h
Merged PRs (30d)
11

Description

@huwshimi @petermakowski it seems this PR leans into being a discussion about how we approach props API in our components. The more complex the component gets (like `MainTable`, this navigation, etc) the harder it is to pass all needed data as props and maintain flexibility that we are used to with Vanilla (being able to adjust HTML structure, class names, etc).

I'm starting to think that the way MUI approaches it (by using the composable child components) seems to be more flexible in this regard (for example: https://mui.com/material-ui/react-bottom-navigation/).

I feel that we had a similar discussion in the past (when Modular Table was started maybe?), but I don't remember where it landed.

I don't know what's the best approach, but the more complicated "items" props will be the harder it will be to use it or maintain in future.
Or maybe some compromise would be to have a set of smaller composable components (`NavigationBar`, `NavigationItems`, `NavigationSearch`, etc) that you can use to custom build any "non standard" configuration for navigation, but we also provide `MainNavigation` component that you just pass props to that should cover most cases - kind of similar to what we have with `MainTable` being a controller component for Table/TableRow/TableCell, etc…

_Originally posted by @bartaz in https://github.com/canonical-web-and-design/react-components/pull/767#discussion_r865855599_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.