-
Hello, I am looking forward to use StyleX with a headless library like Radix UI primitives or Ark-ui. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 14 replies
-
Like this: <Accordion.Item {...stylex.props(styles)} /> Except you can't style state via Source: https://www.radix-ui.com/primitives/docs/guides/styling
|
Beta Was this translation helpful? Give feedback.
-
What is the best way for react-aria-components to get the render prop inside the {...stylex.props(...)} object in order to toggle conditional styles. https://react-spectrum.adobe.com/react-aria/Button.html#styling ({ isFocusVisible }) => isFocusVisible && styles.focusVisible import {
Button as AriaButton,
type ButtonProps as AriaButtonProps,
} from "react-aria-components";
import type { StyleXStyles } from "@stylexjs/stylex";
import * as stylex from "@stylexjs/stylex";
type ButtonProps = Omit<AriaButtonProps, "style">;
const styles = stylex.create({
base: {
fontWeight: 500,
},
focusVisible: {
outlineColor: "red"
}
});
const Button = ({
style,
...props
}: ButtonProps & { style?: StyleXStyles }) => (
<AriaButton {...props} {...stylex.props(styles.base, style)}></AriaButton>
);
export { Button }; |
Beta Was this translation helpful? Give feedback.
I found the documentation a bit unclear as well, but if you need to observe
data-state
within StyleX, it's possible with a workaround:NOTE: This is a workaround and may stop working sometime in the future.