@invisible/design-system-tokens
v1.2.0
Published
This repository contains the MUI theme object derived from Figma design tokens from Invisible's Design team.
Downloads
191
Maintainers
Keywords
Readme
design-system-tokens
This repository contains the MUI theme object derived from Figma design tokens from Invisible's Design team.
Tokens
Simply copy paste the Figma tokens generated by tokens-studio into scripts/tokens/tokens.json
.
CLI Commands
// install dependencies
pnpm i
// generate the theme object
pnpm generate-mui
// build
pnpm build
Project structure
Scripts
main.ts
The main script is used to generate the mui-theme that will be consumed by createTheme
from @mui/material/styles
.
config.json
Use this config file to configure the files you want to generate and the associated Style Dictionary format.
mui-theme
This folder contains the generated
folder which contains generated code from the scripts.
The theme.ts
file has the MUI theme object exported.
Each top level key in the theme object is separated for simplicity and separation of concerns. Currently, only typography
is in the theme object due to the format of tokens.json
, but we can easily add more in the future by registering a format in main.ts
and updating config.json
.
Concepts
For those who don't know what Style Dictionary this, the following is a quick overview of some of the concepts that you will find useful to browse this repo.
Config
config.json defines where to find the design tokens, where to output generated files, and the associated transform.
Transforms
Transforms are functions that modify a token so that it can be understood by a specific platform.
You can define custom transforms with the registerTransform
Transform Group
Transform Groups are a way to easily use multiple transforms at once. They are an array of transforms. You can define a custom transform group with the registerTransformGroup.