When creating a design system, it's important to make sure that the system is flexible and can be easily extended. This allows the design system to be used in a variety of contexts and applications.
One way to do this is to expose the design system's tokens to the end-user. This allows the user to easily customize the design system to fit their needs.
Exposing theme tokens
Based on your design systems' specifications, theme tokens can vary. Let's use a portion of Material Design's color roles as an example.
Based on the specifications, we need to have a primary color, a secondary color, a tertiary color, and an error color. All of which have a background, and a text color. We can create a theme token for each of these colors. We're going to create the theme file inside of the foundations directory of our design system.
We can also implement their container variants using token nesting.
Now we can start opening this up to the end-user by transferring the values to modifiable variables.
This way, the end-user can easily override the default values upon import.
Exposing component tokens (keys)
In the same way, we can expose component tokens to the end-user. Let's say we have a component that has a fill, an ink, and a border color. We can create a key for each of these properties.
We can then expose these keys to the end-user by transferring the values to modifiable variables.
The end-user can then override the default values upon import.