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

[Feature request] Allow set default control type for all types #16818

Open
dartess opened this issue Nov 29, 2021 · 6 comments
Open

[Feature request] Allow set default control type for all types #16818

dartess opened this issue Nov 29, 2021 · 6 comments

Comments

@dartess
Copy link
Contributor

dartess commented Nov 29, 2021

Is your feature request related to a problem? Please describe

I cannot set the default control type for my props

Describe the solution you'd like

Control addon already has Custom control type matchers. But it allows you to configure only two types of controls.

Are you able to assist to bring the feature to reality?

I can do MVP. But I don't know much about the internal implementation of the project and may be missing something.

@shilman
Copy link
Member

shilman commented Nov 29, 2021

@dartess can you share a bit more about your use case?

@dartess
Copy link
Contributor Author

dartess commented Nov 29, 2021

The children prop in React is completely useless at the moment (or I haven't found how to cook it).

Control is displayed as JSON and cannot be changed in a convenient way.

I would like to set the default control type as null for it:

    matchers: {
      color: /(background|color)$/i,
      date: /Date$/,
      null: /^children$/,
    },

and override it as needed in the component's documentation.

@shilman
Copy link
Member

shilman commented Nov 30, 2021

@yannbf thoughts?

@dartess
Copy link
Contributor Author

dartess commented Nov 30, 2021

Another example:
image
Callback controls are completely useless. I would also like to specify null type for all props that start with "on".

@stale
Copy link

stale bot commented Jan 9, 2022

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Jan 9, 2022
@shilman shilman added the todo label Jan 11, 2022
@stale stale bot removed the inactive label Jan 11, 2022
@mirka
Copy link

mirka commented Feb 21, 2022

I think it would be a huge improvement in TypeScript contexts if we could have more control over matchers.

We have a lot of controls auto-generated via react-docgen-typescript, and run into things like:

  • A control for the prop color does match the regex, but doesn’t become a Color control because our internal type for the prop is React.CSSProperties['color'], instead of string.
  • A control for the prop size has the internal type React.CSSProperties['fontSize'], but we want it to just be a String control.

And because this kind of thing happens on many different components, it would be great if they could be regex-matched globally instead of configured per-component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants