Replies: 2 comments
-
You have an error in your code. You defined const btnVariants = tv({
base: 'font-semibold py-1 active:opacity-80',
variants: {
color: {
primary: 'bg-blue-100 hover:bg-blue-700',
secondary: 'bg-purple-100 hover:bg-purple-700',
sucess: 'bg-green-100 hover:bg-green-700'
},
size: {
sm: 'py-0 px-2 text-sm',
md: 'py-1 px-2 text-md',
lg: 'py-1.5 px-3 text-lg'
},
- defaultVariants: {
- color: 'primary',
- size: 'md'
- },
},
+ defaultVariants: {
+ color: 'primary',
+ size: 'md'
+ },
}); |
Beta Was this translation helpful? Give feedback.
0 replies
-
Indeed. Thank you. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello. Thank you for this wonderful package.
Assuming the following (notice there is no background-color in
base
):...the following:
...will only apply
base
andsize:sm
. The only way to get a default background-color rendered is to define it inbase
. In most casesbase
mostly yields output similar todefaultVariants
.It would be nice to not have to apply the same properties in
base
when there is adefaultVariants
, and to have have keys indefaultVariants
applied where the key does not exist in the "input" -- if not by default, to at least have a config option to enforce the same.With this the following usage (example in Svelte):
...would apply the
defaultVariants
, but withsize: 'sm'
.Beta Was this translation helpful? Give feedback.
All reactions