Closed wilsonlewis closed 1 year ago
Have you found a way to do this?
You can modify the defaultConfig
variable.
import { defaultConfig } from 'tailwind-variants'
defaultConfig.twMerge = false
Awkward API but ok. Thanks a bunch.
Hey @adonaicandido another way is to create your own instance of tailwind-variants
without twMerge
Example:
import {tv as tvBase, TV} from "tailwind-variants";
export const tv: TV = (options, config) =>
tvBase(options, {
...config,
twMerge: false,
twMergeConfig: {
...config?.twMergeConfig,
},
});
// button.tsx
import {tv} from "./your-tv-file.ts"
const button = tv({
base: "font-medium bg-blue-500 text-white rounded-full active:opacity-80",
variants: {
color: {
primary: "bg-blue-500 text-white",
secondary: "bg-purple-500 text-white",
},
size: {
sm: "text-sm",
md: "text-base",
lg: "px-4 py-3 text-lg",
},
},
compoundVariants: [
{
size: ["sm", "md"],
class: "px-3 py-1",
},
],
defaultVariants: {
size: "md",
color: "primary",
}
});
The new createTV
function is released and the new config docs are published!
Would like the ability to edit the default config:
Mostly just want to turn off
twMerge
by defaultYou could do it one of two ways:
or