Add ability to remove default sizes/variants/colorSchemes
See original GitHub issue🚀 Feature request
Add the ability to remove the a default size, variant, and/or color scheme for a given component. For example, removing the ability to specify xs
as a size
for the Button
component.
If there is a method to do this already, I can close this issue. However, I could find nothing in the docs that looked to provide this functionality.
🧱 Problem Statement / Justification
Our design system has very specific size, color, and variants for buttons (and other components). We would like the ability to update Chakra to adhere to that design system and limit the available options for certain components. This would reduce the risk of developers implementing a component that does not adhere to the design system.
✅ Proposed solution or API
One solution would be to provide methods for overriding certain parts of the theme instead of extending it. This is similar to how Tailwind has implemented their theme configuration (https://tailwindcss.com/docs/theme#overriding-the-default-theme).
Another option would be to have a function that just removes a variant/size/color option from a component, since the extendTheme
option already provides a method for changing the default variant/size/colors that you want to keep but modify.
Finally one other option would be to update extendTheme
to allow you to pass undefined
for the option you want to remove.
Then being able to use the Chakra CLI to update the typings so that whatever you have overridden/removed is no longer autocompleted when writing a component.
↩️ Alternatives
Currently we have to create wrapper components for components like Button
in order to limit the available options, which isn’t as ideal.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:24
- Comments:15 (3 by maintainers)
Top GitHub Comments
Would still love to see this get implemented.
+1 we would also love to see this feature - we have a tight knit design system and do not want to see the default Chakra values when autocompleting values with Typescript.