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.

How to extend ColorVariant, ButtonVariant, etc.?

See original GitHub issue

What you are trying to do I can extend bootstrap using scss. For example, add my own colors, sizes, etc. But I can’t use them.

What you have already tried

<b-button variant="purple">Purple button</b-button>

Any error messages you are getting TS2322: Type ‘“purple”’ is not assignable to type ‘ButtonVariant | undefined’.

Environment:

  • OS: MacOS Monterey 12.6
  • Version: 0.3.12

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
VividLemoncommented, Nov 5, 2022

I’ll review it again in the morning and go from there

0reactions
aceofwingscommented, Nov 5, 2022

I was exploring and couldn’t find much on using unions to extend the ButtonVariant type. I think it is the only solution right now but there is a typescript doc for extending namespaces. It is a very transparent change so I don’t mind merging it until something better comes along .

Read more comments on GitHub >

github_iconTop Results From Across the Web

extending variants · Discussion #2974 · chakra-ui ... - GitHub
Hi @chasinhues - I would like to change the default _hover and _active shades for button variants dynamically for each colorScheme color.
Read more >
How do I globally override variant, color, style, etc. for Material ...
You can do this with global overrides for your theme.
Read more >
How to create visual variants for React components using ...
Meaning you need the component to change, perhaps, color to convey different information. For example: A button can be normal, primary, ...
Read more >
Color Variants | Reference - BootstrapVue
Color variants available when using the default Bootstrap v4 CSS and their mappings to CSS classes.
Read more >
Understanding Theme UI: 6 - The Hacks - Paul Scanlon
You can use this approach for as many button variants as you require, but do always "extend" using the variant before applying new...
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