suus-design-tokens
v1.0.18
Published
Design tokens for the SUUS project, built with Style Dictionary.
Readme
suus-design-tokens
Design tokens for the SUUS project, built with Style Dictionary.
Installation
To use these design tokens in your project, install the package from npm:
npm install suus-design-tokensUsage in a React TypeScript Project
You can import the design tokens in different formats depending on your needs.
Importing CSS Variables
Import the CSS file to use the tokens as CSS custom properties:
import 'suus-design-tokens/css';Then use them in your CSS or styled components:
.my-component {
color: var(--color-brand-primary);
padding: var(--spacing-small);
}Importing JavaScript Object
Import the tokens as a JavaScript object:
import { tokens } from 'suus-design-tokens/tokens';Use in your React components:
import React from 'react';
import { tokens } from 'suus-design-tokens/tokens';
const MyComponent: React.FC = () => {
return (
<div
style={{
color: tokens.color.brand.primary.$value,
padding: tokens.spacing.small.$value,
borderRadius: tokens.radius.small.$value,
}}
>
Hello World
</div>
);
};
export default MyComponent;Importing JSON
Development
Prerequisites
- Node.js (version 14 or higher)
- npm
Building the Project
Install dependencies:
npm installBuild the tokens:
npm run buildThis will generate the output files in the
dist/directory.
Publishing to npm
Ensure you are logged in to npm:
npm loginUpdate the version in
package.json(e.g., patch, minor, or major):npm version patchPublish the package:
npm run publishNote: The
prepublishOnlyscript will automatically run the build before publishing.
Project Structure
tokens/: Source token files organized by category (primitive, semantic, component)style-dictionary.config.mjs: Configuration for Style Dictionarydist/: Generated output files (CSS, JS, JSON)
Contributing
- Make changes to the token files in
tokens/ - Run
npm run buildto generate updated outputs - Test your changes
- Commit and push your changes
