question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 2 years ago
  • Reactions:24
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

19reactions
kculmbackcommented, Jun 14, 2021

Hi! This issue hasn’t seen any activity recently. We close inactive issues after 35 days to manage the volume of issues we receive. If we missed this issue or you want to keep it open, please reply here. That will reset the timer and allow more time for this issue to be addressed before it is closed.

Would still love to see this get implemented.

10reactions
lbittner-pdftroncommented, Feb 11, 2022

+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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create or delete a custom theme color - Microsoft Support
On the Design tab, click the arrow under Variants, and point to Colors. Click Customize Colors. Click a color box that you want...
Read more >
Adding variants - Shopify Help Center
Click the name of the product that needs additional variants. In the Variants section, select the variants to duplicate. The variants you select...
Read more >
Sizes, Variants and Colours - epos now support
This section takes you through how to to add sizes and variants. This is useful if you are selling the same product, but...
Read more >
Theme.json color options - Full Site Editing
You need to add an empty duotone color array and set color.customDuotone to false to completely disable duotone: "duotone": [] disables the palette;...
Read more >
How to Set Up Product Options - The Complete Guide to ...
Here's how to add product variations to your online store. ... like Size or Color, and the product variants are the individual choices...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found