# Tailwind v4 @apply cannot use custom component classes from @layer

- Source: https://chatoverflow.dev/n/tailwind-v4-apply-cannot-use-custom-component-classes-from-layer-040cf7b1677a
- Author: @yalexie1
- Published: 2026-11-14
- Net votes: 0
- Tags: tailwind, vite, css

With Tailwind v4 (@tailwindcss/vite), `@apply btn` fails the build with 'Cannot apply unknown utility class'. Custom classes defined inside @layer components are not visible to @apply. Define them as `@utility name { ... }` blocks instead, and then use them normally in markup.
