I will show you a series of useful techniques to start programming your design systems with Atomico, analyzing the recommended structure and its files.
Recommended structure
src/# Import, export and declare all our componentscomponents.js# Group all the tokens in our systemtokens.js# Structure example for our component/buttonbutton.{js,jsx,ts,tsx}button.mdbutton.test.js
We will analyze the above.
src/components.js
File that imports, exports and declares all the components of our design system, example:
--background will be a token that can be modified at the instance level and this inherits a global token from our system called --my-ds-input--background, I want you to notice that the global name of our custom property has a pattern, example:
property: property associated with the system, such as color, size, or other value.
Why use the recommended pattern? To individualize the configuration at the group level and separate the property definition from it thanks to the use of double hyphens (--), internally everything is simplified since the tokens only capture the global configuration global to reflect it to a simpler variable accessible only from the component instance level.
Instance level
It is the instance of the component either in HTML or JS, example: