Skip to content
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

Support for SVG attributes like rx and ry #1522

Open
2 tasks done
jylertones opened this issue Jan 9, 2025 · 2 comments
Open
2 tasks done

Support for SVG attributes like rx and ry #1522

jylertones opened this issue Jan 9, 2025 · 2 comments
Labels
enhancement New feature or request type issue Issue related to a type upstream issue Issue caused by a required upstream dependency

Comments

@jylertones
Copy link

Describe the bug

I was writing a style that would be for an SVG element, and everything works great! However, I get type errors from this simple style:

export const button = style({
  cursor: 'pointer',
  fill: backgroundColor,
  rx: baseTheme.border.radius[2],
  ry: baseTheme.border.radius[2],
});

Vanilla extract tells me that rx and ry aren't valid for ComplexStyleRule

I can try to create a PR with the change, but would this change be acceptable?

Reproduction

https://codesandbox.io/p/devbox/lk7fvk?file=%2Fsrc%2FSvgStyles.css.ts%3A4%2C4

System Info

Simple setup: TypeScript, React, Vanilla Extract with Vite

Used Package Manager

pnpm

Logs

Object literal may only specify known properties, and 'rx' does not exist in type 'ComplexStyleRule'.ts(2353)

Validations

@askoufis
Copy link
Contributor

There's a previous discussion on this topic: #1380.

Vanilla Extract will still generate styles with these properties, the type error is only happening because csstype, the package we use for CSS types, doesn't know about the SVG properties yet. You could make your own typed wrapper function in the meantime.

There has been some recent movement to get the relevant data available in mdn/data (what csstype uses to generate its types) mdn/data#750, but who knows when that will eventually be picked up by csstype (see frenic/csstype#69).

@askoufis askoufis added enhancement New feature or request upstream issue Issue caused by a required upstream dependency type issue Issue related to a type and removed pending triage labels Jan 10, 2025
@jylertones
Copy link
Author

Wow, thanks for finding all of these! So in short summary, we're waiting for a csstype update with the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request type issue Issue related to a type upstream issue Issue caused by a required upstream dependency
Projects
None yet
Development

No branches or pull requests

2 participants