-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
ToggleGroupControl: Document and add disabled prop in types.ts #69715
base: trunk
Are you sure you want to change the base?
ToggleGroupControl: Document and add disabled prop in types.ts #69715
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, there is a way to add custom filter logic to react-docgen-typescript
so that any disabled
props will always be visible in the Storybook props table (and thus the auto-generated readmes). Do you think that's worth doing?
IIRC, the default logic filters out standard HTML attribute props that don't have explicit descriptions, as well as prop type definitions that originate in node_modules
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could make exceptions for the most important / impactful attributes such as disabled
What?
Discovered while working on #57862
Related comment: #57862 (comment)
Why?
This PR documents the disabled prop for ToggleGroupControlOption and adds proper TypeScript type definitions for better developer experience.
While PR #63450 added the functionality to disable individual options in ToggleGroupControl, this wasn't documented in the README or demonstrated in Storybook examples. Adding this documentation and proper TypeScript types improves discoverability and makes implementation more consistent with other components in the library.
How?
I worked on the following improvements:
These changes align with how other components like Button, FormToggle, and DropdownOption handle their disabled states.