Skip to content

btn-disabled not work for Arbitrary #17057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cqh963852 opened this issue Mar 8, 2025 · 2 comments
Closed

btn-disabled not work for Arbitrary #17057

cqh963852 opened this issue Mar 8, 2025 · 2 comments

Comments

@cqh963852
Copy link

What version of Tailwind CSS are you using?

4.0.12

What build tool (or framework if it abstracts the build tool) are you using?

nextjs 15.2.1

What version of Node.js are you using?

v22.13.1

What browser are you using?

Chrome

What operating system are you using?

mac sequoia 15.3

For example: macOS, Windows

Reproduction URL

https://github.com/cqh963852/daisyui-demo

Describe your issue

btn-disabled not work for Arbitrary

bg-primary works

Image

Image

@wongjn
Copy link
Contributor

wongjn commented Mar 8, 2025

This is due to the fact that .btn-disabled is not registered by Daisy UI as a utility class name of itself. Daisy UI does something akin to:

addComponents({
  ".btn": {
    // …
    "&:is(:disabled, [disabled], .btn-disabled)": {
      // …
    },
  },
  ".btn-primary": {
    // …
  },
});

With the way the legacy addComponents() API interface works, only the top-level selectors get registered as known class names to Tailwind. I believe it would be out of scope to get Tailwind to delve into deeper selectors, especially since this only exists as a backwards-compatibility layer.

You could consider raising this issue with Daisy UI.

Or otherwise, you can copy the CSS into your own utility class name:

@utility btn-disabled {
  @layer components {
    &:not(.btn-link, .btn-ghost) {
      background-color: color-mix(in oklab, var(--color-base-content) 10%, transparent);
      box-shadow: none;
    }

    pointer-events: none;
    --btn-border: #0000;
    --btn-noise: none;
    --btn-fg: color-mix(in oklch, var(--color-base-content) 20%, #0000);

    @media (hover: hover) {
      &:hover {
        background-color: color-mix(in oklab, var(--color-base-content) 10%, transparent);
        pointer-events: none;
        --btn-border: #0000;
        --btn-fg: color-mix(in oklch, var(--color-base-content) 20%, #0000);
      }
    }
  }
}

@cqh963852
Copy link
Author

Sorry, I submitted the issue to the wrong repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants