-
I want to create a class that can receive mutiple abritrary values like I tried Can anybody help me? many thanks🙏🏻🙏🏻🙏🏻 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Have some kind of predetermined delimiter in the arbitrary value and then split the value by this delimiter. For example, here we use a plus sign ( /** @type {import('tailwindcss').Config} */
module.exports = {
plugins: [
require('tailwindcss/plugin')(({ matchUtilities }) => {
matchUtilities({
'my-class': value => Object.fromEntries(
value.split('+').map((v, i) => [`--foo-${i}`, v])
),
});
})
],
} Then you'd use arbitrary values like See this Tailwind Play for a working example (open the Generated CSS panel to see the CSS results). |
Beta Was this translation helpful? Give feedback.
-
Is there a way to do so in TailwindCSS v4? |
Beta Was this translation helpful? Give feedback.
Have some kind of predetermined delimiter in the arbitrary value and then split the value by this delimiter.
For example, here we use a plus sign (
+
) as a delimiter:Then you'd use arbitrary values like
my-class-[a+b+c]
.See this Tailwind Play for a working example (open the Generated CSS panel to see the CSS results).