Skip to content
Discussion options

You must be logged in to vote
@layer components {
    .btn-link {

Creates a CSS rulehttps://developer.mozilla.org/en-US/docs/Web/CSS/Syntax#css_rulesets .btn-link in the components CSS cascade layer. You can use it in your HTML like:

<button class="btn-link">

@utility btn-* {
    .btn-link {

Doesn't do anything. The -* suffix at the end is for functional utility syntax but no indication of values, types or bare value types are indicated in this directive body. This means there is no way to write a class name that would generate CSS using this directive as-is.


As an aside, Adam Wathan (creator of Tailwind) does seem to advocate avoiding @apply:

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
3 replies
@wongjn
Comment options

wongjn Jan 30, 2025
Collaborator

@tahaListens
Comment options

@tahaListens
Comment options

Comment options

You must be logged in to vote
3 replies
@tahaListens
Comment options

@wongjn
Comment options

wongjn Jan 30, 2025
Collaborator

@tahaListens
Comment options

Answer selected by tahaListens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants