Skip to content

[material-ui] Provide more direct documentation access to props of "inherited" components #18288

@ryancogswell

Description

@ryancogswell

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:

  1. Delegating to a root element wrapped by the main component. Any props not recognized by the main component will be passed down to this root element. Example: Menu wraps Popover which in turn wraps Modal.
  2. Delegating to components other than the root element. Props are generally passed to these components via a prop on the main component with a name of <InnerComponentName>Props. Example: Select leverages Menu and receives props for the Menu element via its MenuProps 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 for Popover and Modal would be included directly in the Menu 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsImprovements or additions to the documentation.scope: docs-infraInvolves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305).

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions