Theme tokens not populated #19272
-
Hi, Not sure what I am doing wrong. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Could you recreate your environment or a simplified version of the issue in one of the sandboxes available at https://github.com/carbon-design-system/sandboxes? |
Beta Was this translation helpful? Give feedback.
-
This usually happens if the theme provider or styles package isn’t set up correctly, so the CSS custom properties don’t get injected. A few things to check:
If you’ve done the above, you should see the tokens populated in DevTools (e.g. Hope that helps! 😊 |
Beta Was this translation helpful? Give feedback.
This usually happens if the theme provider or styles package isn’t set up correctly, so the CSS custom properties don’t get injected. A few things to check:
Import the CSS reset and theme tokens
Make sure you’ve imported the core styles in your entry point (e.g.
index.js
orApp.js
):or if you’re using Sass:
Without this, the
--cds-*
tokens (like--cds-label-02
or--cds-heading-01
) won’t be defined.Use the
Theme
component (React)Wrap your app or a section of it with the Carbon
Theme
component to ensure the right theme context is applied: