Being able to target elements with data attributes #380
-
Describe the feature requestI'm working on a project where we're combining StyleX and Radix-UI and their Select component has a
.SelectItem[data-disabled] {
color: var(--mauve-8);
pointer-events: none;
}I think because it's not an actual I've been looking through docs and code for StyleX and I can't find any way to do this |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
This pattern isn't officially supported, but you can use We don't recommend this pattern in general and prefer applying styles conditionally instead. Using attribute selectors leads to a duplicate CSS rule where an existing className would've sufficed. |
Beta Was this translation helpful? Give feedback.
-
|
@nmn is this going to be supported at some point? it feels strange to use a pattern that is not recommended. it also seems standard for headless ui libraries to use data attributes for state. for others stumbling upon this - discussion #509 was helpful specifically for react-aria |
Beta Was this translation helpful? Give feedback.

This pattern isn't officially supported, but you can use
:is([data-disabled])where you would normally use:hoverto get around this problem for now.We don't recommend this pattern in general and prefer applying styles conditionally instead. Using attribute selectors leads to a duplicate CSS rule where an existing className would've sufficed.