How to add tokens? #5622
Replies: 1 comment
-
I posted answer to a similar question on Discord, I'll copy it here! (this is from the lit.dev/discord) It's kind of a long and complicated answer. The tokens framework is built on https://sass-lang.com/, which is a pre-compiler language that turns Sass I would recommend starting with the Sass website to get an understanding of the fundamentals for things like Sass functions, mixins, variables, and data structures like maps. Afterwards, this is how it's broken down:
To add new tokens, you can look at filled button for an example, where we add spacing tokens that aren't tokenified from the design database yet: material-web/tokens/_md-comp-filled-button.scss Lines 91 to 97 in 7f3d9d1 To change tokens, you can look at filled text field. We edit an existing token for the focus indicator, which has the wrong value in tokens v0.192: material-web/tokens/_md-comp-filled-text-field.scss Lines 168 to 174 in 7f3d9d1 Hope that helps! 🙂 Also yes, we do need to document this. There's a lot we need to set up and write docs for to help others onboard for contributing. |
Beta Was this translation helpful? Give feedback.
-
Is there a documentation on how to add more tokens to material web (contribute) without deep diving into your whole code? We are missing some customization options here and there (like radio button's thickness, background color for an outlined disabled text field etc.). Injecting those styles via JS feels really awkward and not clean for a big project. We want to keep all styles clean and separated in one place.
Some documentation on this would be amazing.
Beta Was this translation helpful? Give feedback.
All reactions