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

StylesOptions' zIndex should accept string values #1113

Open
AndreSilva1993 opened this issue Dec 5, 2024 · 1 comment
Open

StylesOptions' zIndex should accept string values #1113

AndreSilva1993 opened this issue Dec 5, 2024 · 1 comment

Comments

@AndreSilva1993
Copy link

AndreSilva1993 commented Dec 5, 2024

🐛 Bug Report

Not necessarily a bug but would like to propose that the zIndex prop under the StylesOptions takes in a string as well.

export interface StylesOptions {
  arrowColor: string;
  backgroundColor: string;
  beaconSize: number;
  overlayColor: string;
  primaryColor: string;
  spotlightShadow: string;
  textColor: string;
  width?: string | number;
  zIndex: number; <--------
}

In our project we're using MUI and adopting their newly CSS variables. Before using this API, the theme object would contain the actual numeric values which then we could do something like zIndex: theme.zIndex.drawer + 1.

Since now the new theme.vars gives us something like var(--mui-zIndex-drawer) our idea was to use the following which is valid CSS calc(${theme.vars.zIndex.drawer} + 1) but the StylesOptions forces us to pass numeric values.

@gilbarbara
Copy link
Owner

Hey @AndreSilva1993

Did you try to set the zIndex as a string and ts-ignore the error? Does it work?

The problem with accepting plain strings is that users can set 1000px and break it.
A template string would be acceptable, and I can still validate it in the code.

zIndex: number | `var(---${string})`;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants