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

Opacity modifier typing error for strictTokens #2219

Closed
1 of 3 tasks
BorisZubchenko opened this issue Feb 17, 2024 · 1 comment
Closed
1 of 3 tasks

Opacity modifier typing error for strictTokens #2219

BorisZubchenko opened this issue Feb 17, 2024 · 1 comment

Comments

@BorisZubchenko
Copy link

Description

When strictTokens is set to true, using opacity modifiers like red.500/40 produces a TypeScript error:
image

Link to Reproduction

see additional information

Steps to reproduce

  1. strictTokens: true
  2. css({ bg: 'red.500/40' })
  3. TS2820: Type 'red.500/40' is not assignable to type PropOrCondition<'bg', ColorToken> | undefined. Did you mean 'red.500'?

JS Framework

React (TS)

Panda CSS Version

0.31.0

Browser

No response

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

I can't give you a link to a reproduction because opacity modifiers don't work at all for reproductions:
image
Notice that the background is transparent.

@segunadebayo
Copy link
Member

segunadebayo commented Feb 17, 2024

This is by design. We'll update the docs for the opacity modifier.

Opacity modifiers are considered a "design escape hatch" to prototype UIs quickly. The strict token mode enforces using only design tokens.

You could consider using bg: [red.700/40]

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