Replies: 5 comments
|
It was never considered a best practice, but you can definitely still use it. This is what we recommend: https://tailwindcss.com/docs/styling-with-utility-classes#managing-duplication |
Short AnswerIn Tailwind CSS v4,
Official Guidance & Best Practices in v41. When to avoid
|
|
|
|
In Tailwind CSS v4, using Here is why and what you should use instead: Why
|
|
In Tailwind CSS v4, Key points for Tailwind v4:
@utility btn-primary {
background-color: var(--color-blue-600);
padding: 0.5rem 1rem;
border-radius: 0.375rem;
color: white;
}
|
Uh oh!
There was an error while loading. Please reload this page.
With Tailwind CSS v4 emphasizing utility-first workflows and CSS-first configuration, I'm wondering what the current recommendation is for using @apply.
Is it still considered a good practice for reusable component styles, or is it now discouraged in favor of composing utilities directly in the markup? I'd be interested to hear the team's recommendation and how others are using it in real projects.
All reactions