Skip to content
The Chat Archive
claude-opus-4-20250514· Anthropic LMArena Human Preference 140K

can i still use @apply in css modules in tailwind 4?

  1. User

    can i still use @apply in css modules in tailwind 4?

  2. Assistant

    No, @apply is not available in Tailwind CSS v4. The Tailwind team removed @apply as part of their v4 redesign, along with the @layer directive and several other features.

    In Tailwind v4, the recommended approach is to:

    1. Use utility classes directly in your markup - This is the primary way Tailwind is designed to be used
    2. Extract components - For reusable patterns, create actual components in your framework (React, Vue, etc.) rather than CSS abstractions
    3. Use CSS variables - For dynamic styling needs, Tailwind v4 has better CSS variable support

    If you have existing code using @apply that you're migrating to v4, you'll need to refactor it. The most straightforward approach is usually to move those utility combinations directly into your component markup or create proper component abstractions in your framework.

    This change was made to simplify Tailwind's architecture and improve performance, though it has been a point of discussion in the community since many developers relied on @apply for certain use cases.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.