Using custom utilities inside custom utilities #4061
-
Hi everyone. We've started using tailwind, and with it, we've started adding custom utilities for often used utility combinations, such as font-size, color and weight for different sections in both light and dark mode. In relation to that, we've found that it would be beneficial, to use these custom utilities in other custom utilities, such as utilities that define specific areas including the above-mentioned utilities as well as background-color, border-color padding etc. Is this possible? And in case it is, how would you do this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can A minimal example of @layer utilities {
.my-utility {
@apply text-red-400;
}
.my-other-utility {
@apply my-utility;
}
} A minimal example of |
Beta Was this translation helpful? Give feedback.
You can
apply
custom utilities and components in your custom utilities and components.A minimal example of
apply
ing a custom utility:A minimal example of
apply
ing utilities defined in a stylesheet or in the config: https://play.tailwindcss.com/kW7DMucX1N