We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
TypeError when passing a style object with default variants or of type CSS
defaultVariants
const smallChipStyles = { display: "inline-block", padding: "8px", borderWidth: "1px", borderStyle: "solid", variants: { color: { blue: { color: "blue", borderColor: "blue" } } }, // Adding default variants to a style object // shows a type error. // Remove this then the error goes away. + defaultVariants: { + color: 'blue', + }, };
CSS
+ const bigChipStyles: CSS = { display: "inline-block", padding: "8px", borderWidth: "1px", borderStyle: "solid", variants: { color: { blue: { color: "blue", borderColor: "blue" } } }, defaultVariants: { color: 'blue', }, };
CodeSandbox: https://codesandbox.io/s/festive-bell-jn5de?file=/src/App.tsx
My use-case for this was using Radix then using the styles of an existing component.
Example:
export const StyledButton = styled('button', BUTTON_STYLES); // Dialog.Trigger from Radix export const StyledTrigger = styled(Dialog.Trigger, BUTTON_STYLES);
In this example, the Dialog's Trigger and the styled Button have the same styles.
The text was updated successfully, but these errors were encountered:
Fixed in V1. Please refer to migration guide and changelog
Sorry, something went wrong.
No branches or pull requests
Bug report
TypeError when passing a style object with default variants or of type CSS
Describe the bug
1. When a style object has a
defaultVariants
, it shows a type error.2. Variants is lost when you use
CSS
for the style object's type+ const bigChipStyles: CSS = { display: "inline-block", padding: "8px", borderWidth: "1px", borderStyle: "solid", variants: { color: { blue: { color: "blue", borderColor: "blue" } } }, defaultVariants: { color: 'blue', }, };
To Reproduce
CodeSandbox: https://codesandbox.io/s/festive-bell-jn5de?file=/src/App.tsx
System information
Additional context
My use-case for this was using Radix then using the styles of an existing component.
Example:
In this example, the Dialog's Trigger and the styled Button have the same styles.
The text was updated successfully, but these errors were encountered: