Fix(separator): use data-[orientation] selectors to fix invisible separator in Tailwind v4#9572
Fix(separator): use data-[orientation] selectors to fix invisible separator in Tailwind v4#9572syazwanz wants to merge 6 commits intoshadcn-ui:mainfrom
Conversation
|
@syazwanz is attempting to deploy a commit to the shadcn-pro Team on Vercel. A member of the Team first needs to authorize it. |
|
I see. any reason why you don't want the |
No issues with the custom variants themselves, but when I set up my project, Since new-york-v4 already uses the bracket syntax, this just aligns base and radix to match. Happy to close if you'd rather keep the custom variants though. |
|
In my case, when applying the data attribute shorthand syntax in the className of a newly updated component (e.g., data-[orientation=horizontal] in the Separator component was updated to data-horizontal), styles were missing and not applied. To resolve this,
The official documentation currently omits the section "Your project requires `@import "shadcn/tailwind.css"; in its CSS file, which requires the 'shadcn' package to be installed." I believe the above should be added, as it only provides instructions for setting up a project for the first time, which could be confusing for people who have been using it for a long time, like me. |
Summary
The
Separatorcomponent in the base and radix registries usesdata-horizontal:/data-vertical:custom variant shorthands for orientation styling.These require
@import "shadcn/tailwind.css"which defines the corresponding@custom-variant.Without it, Tailwind v4 treats them as boolean attribute checks, the styles are never applied, and the separator renders invisible (0px height/width).
This replaces the shorthands with
data-[orientation=horizontal]:/data-[orientation=vertical]:selectors to match thenew-york-v4style.Related