-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[material-ui] Provide more direct documentation access to props of "inherited" components #18288
Comments
@ryancogswell Agree, we have a related thread in #17872 (comment). cc @eps1lon. |
Thanks for the ping. I already started exploring this a week ago. The idea is to extract the API into a JSON blob that can be queried at build and runtime. All the api/* routes are squashed into a single entry point that uses a custom version of dynamic routes (custom because the feature is only available in nextjs 9). For server rendering we render the same content as before (although faster since no more markdown parsing) but progressively enhance the amount of props that can be displayed by querying at runtime. API querying is up in the air (at build time? netlify lambda? etc). But the the separation of API data extraction and rendering (previously a single task) is almost complete. Progress can be tracked in master...eps1lon:docs/api-dynamic |
Porting to a full React (instead of markdown) page is basically done but needs another pass that gets the API right (i.e. how to reduce the amount/number of queries cough graphql). In addition it requires a lot of code that will be obsolete with #18441 which will also make other parts of the implementation easier. I probably open a separate PR for the API (since it can stand on its own) and propose the |
Not proud to admit, but I've assumed that a lot of times :)
Add to that HTML properties like |
This comment has been minimized.
This comment has been minimized.
The concrete UI isn't finalized. We'll probably go with some form of expand action for the current props table that adds "inherited props". But we'll also need to re-evaluate the current design. "inherited props" is too often overlooked. Though we also don't know if it is "too often". Might be that 1 in 10000 thousand only misses the hint and due to the sheer volume of user it looks to us like it is a problem. |
This actually is a duplicate of #7981, but that issue is quite old and I think this would be worth re-visiting.
Summary 💡
Many Material UI components delegate to other Material UI components.
There are two main flavors of this delegation:
Menu
wrapsPopover
which in turn wrapsModal
.<InnerComponentName>Props
. Example:Select
leveragesMenu
and receives props for theMenu
element via itsMenuProps
prop.It is the first case (delegation to a root element) for which I think the documentation could be considerably improved.
Currently the documentation forces you to follow links to these other components in order to discover the full set of props that a component supports. Many people, especially new users of the library, do not notice (or fully understand) the "Any other props supplied will be provided to the root element" portion and miss the fact that many more props may be supported by the component. I think it would be much better for users of the documentation if all of the props from "inherited" components were included directly. So in the case of
Menu
, the props forPopover
andModal
would be included directly in theMenu
documentation. It seems like it should be doable for buildApi.js and generateMarkdown.js to be enhanced to automatically include the comprehensive props.Examples 🌈
This Stack Overflow question shows one example of users assuming that a component (AppBar in this case) only supports the properties shown directly on its API page.
Motivation 🔦
I understand that the current way of documenting the properties was an easier approach to implement, but given the place of "Better documentation" within the roadmap priorities, I think it would be worth the additional complexity in the API doc generation (which is already aware of the inherited component) to allow users to find the comprehensive props more easily/quickly.
The text was updated successfully, but these errors were encountered: