Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/__tests__/tv.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,7 @@ describe("Tailwind Variants (TV) - Slots", () => {
base: "color--secondary-base",
title: "color--secondary-title",
},
tertiary: {},
},
},
compoundVariants: [
Expand All @@ -1165,6 +1166,16 @@ describe("Tailwind Variants (TV) - Slots", () => {
title: "truncate",
},
},
{
color: "tertiary",
class: ["color--tertiary-base"],
},
{
color: "tertiary",
class: {
title: "color--tertiary-title",
},
},
],
defaultVariants: {
color: "primary",
Expand All @@ -1181,6 +1192,8 @@ describe("Tailwind Variants (TV) - Slots", () => {
"color--secondary-title",
"truncate",
]);
expect(base({color: "tertiary"})).toHaveClass(["text-3xl", "color--tertiary-base"]);
expect(title({color: "tertiary"})).toHaveClass(["text-2xl", "color--tertiary-title"]);
});

test("should work with native prototype", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ export const getTailwindVariants = (cn) => {
for (let i = 0; i < compoundClassNames.length; i++) {
const className = compoundClassNames[i];

if (typeof className === "string") {
if (typeof className === "string" || Array.isArray(className)) {
result.base = cnFn(result.base, className)(config);
} else if (typeof className === "object") {
for (const slot in className) {
Expand Down