All Projects → lukasoppermann → Design Tokens

lukasoppermann / Design Tokens

Licence: mit
🎨 Figma plugin to export design tokens to json in an amazon style dictionary compatible format.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Design Tokens

Calcite Components
Web Components for the Calcite Design System. Built with Stencil JS. Currently in Beta!
Stars: ✭ 96 (-29.41%)
Mutual labels:  design-system
React Native Design Utility
Utility for building design system in react-native. Idea from TailwindCSS
Stars: ✭ 116 (-14.71%)
Mutual labels:  design-system
Expo Disneyplus
Disney+ UI Clone with React Native & Expo
Stars: ✭ 130 (-4.41%)
Mutual labels:  design-system
Design System
Design system for new Proton project
Stars: ✭ 101 (-25.74%)
Mutual labels:  design-system
Overrideit Sketchplugin
Overrideit is sketch plugin that allow designers to search in overridelist and overrides dropdowns, and with many other features.
Stars: ✭ 113 (-16.91%)
Mutual labels:  design-system
Vue Cion Design System
CION - Design system boilerplate for Vue.js
Stars: ✭ 119 (-12.5%)
Mutual labels:  design-system
Shards Dashboard React
⚛️A free and beautiful React admin dashboard template pack.
Stars: ✭ 1,268 (+832.35%)
Mutual labels:  design-system
Uswds Site
USWDS website and documentation
Stars: ✭ 135 (-0.74%)
Mutual labels:  design-system
Aws Northstar
NorthStar aims to be the standard for rapidly prototyping intuitive, meaningful and accessible user experiences. It simplifies your work and ensures consistent, predictable experiences at scale for your customers. With NorthStar, you can focus on innovation and do more with less.
Stars: ✭ 116 (-14.71%)
Mutual labels:  design-system
React
Modern and minimalist React UI library.
Stars: ✭ 2,546 (+1772.06%)
Mutual labels:  design-system
Devtools Ds
UI components, libraries, and templates for building robust devtools experiences.
Stars: ✭ 105 (-22.79%)
Mutual labels:  design-system
Aksara Ui
Aksara Design System, from Kata.ai.
Stars: ✭ 107 (-21.32%)
Mutual labels:  design-system
React95
A React components library with Win95 UI
Stars: ✭ 1,779 (+1208.09%)
Mutual labels:  design-system
Leaf Ui
🍃 Leaf-UI: A react component library built using styled-components
Stars: ✭ 98 (-27.94%)
Mutual labels:  design-system
Fluid System
Fluid System is a style props function transformer for generating fluid styles. 💦
Stars: ✭ 130 (-4.41%)
Mutual labels:  design-system
Scale
The Scale library offers a set of customizable web components written with Stencil.js & TypeScript. The default theme of the library can be easily replaced so that a corresponding corporate identity of a dedicated brand can be represented.
Stars: ✭ 87 (-36.03%)
Mutual labels:  design-system
Css
The CSS design system that powers GitHub
Stars: ✭ 10,670 (+7745.59%)
Mutual labels:  design-system
Styleguide
The VTEX Design System and React component library.
Stars: ✭ 138 (+1.47%)
Mutual labels:  design-system
Design System
Hack Club's design system
Stars: ✭ 135 (-0.74%)
Mutual labels:  design-system
Yoga
Yoga design-system: a scientific system of practices made to help each one of us achieve our highest potential and experience.
Stars: ✭ 122 (-10.29%)
Mutual labels:  design-system

Design Tokens plugin for figma

Design Tokens

Figma Design Tokens - Export & convert design tokens or sync with github repo. | Product Hunt

Test status Coverage Status

The Design Tokens plugin for figma allows you to export design tokens into a json format that can be used with the Amazon style dictionary package. This allows you to transform your tokens to different languages / platforms like web, iOS or Android.

Table of content

Installation

  1. Go to the design tokens plugin page
  2. Click on install in the top right corner

Plugin usage

The plugin has a couple options in the menu items:

Design Tokens > Export Design Token File

This creates a .json file with all design tokens from your Figma project. A dialog will open allowing you to save the file on your hard drive.

Design Tokens > Send Design Tokens to Url

This triggers a request sending your tokens to a server. For this to work you must have configured a server to send your tokens to in the plugin settings.

Design Tokens > Settings

Opens the settings view, which allows you to change all settings mentioned in the settings section below.

Design Tokens > Help

Opens this documentation page.

Transforming tokens using Amazon style dictionary

  1. Clone the design token transformer repositiory.
git clone https://github.com/lukasoppermann/design-token-transformer.git
  1. Export your tokens using the plugin and place the json file in the tokens folder within the transformer repositry
  2. Run npm run transform-tokens from the commandline
  3. 🎉 Your converted tokens should be in the build folder. For more customization options check out the design token transformer documentation

Creating Design Tokens

Figma style design tokens

The plugin converts the styles you define in Figma into design tokens, this includes Text Styles, Color Styles, Grid Styles and Effect Styles.

Every property of a style will be converted to an individual token. For a Text Styles this may result in the following tokens (show as transformed css custom properties for readability).

  --font-headline-3-font-size: 20;
  --font-headline-3-text-decoration: none;
  --font-headline-3-font-family: Roboto;
  --font-headline-3-font-style: italic;
  --font-headline-3-font-weight: 500;
  --font-headline-3-font-stretch: condensed;
  --font-headline-3-font-style-old: Medium Italic Condensed; /* only to preserve original value */
  --font-headline-3-letter-spacing: 2;
  --font-headline-3-line-height: 160;
  --font-headline-3-paragraph-indent: 5;
  --font-headline-3-paragraph-spacing: 8;
  --font-headline-3-text-case: uppercase;

Naming

Styles don't have to follow a specific naming convention. Any style will be exported into a design token, as long as it does not match the ignore pattern.

This means you can name your styles Headline or Foundation/Colors/Primary/Red/100 and either one works fine.

Ignoring styles

Styles you don't want to be exported as design tokens can be prefixed with an _ underscore. For example a color style called _readlining/line-color will not be exported.

In the settings you can change the prefix for ignoring/including styles.

Custom design tokens

The plugin also supports custom tokens for borders, radii, sizes, spacing & motion.

  • Every custom design token must be directly within a top-level Frame with a name starting with _tokens. This means you have a structure like this: page > _tokens/sizes > sizes/8. Nesting is not possible at this point.
  • The token itself has to have a name starting with sizes, spacing, borders, radii or motion and has to be a Frame, Rectangle or Main Component. This is so that the plugin can identify what is and what isn't a token.
  • The token has to be a direct child of a _token frame

Sizes

To create a sizes token, do the following:

  1. Create a Frame and name it _tokens/sizes
  2. Create another Frame, Rectangle or Main Component and set the width property to your 8.
  3. Name it sizes/8. Note, it is important to use the sizes/ prefix.

The token will be exported, if you convert it to css the output would be something like this:

  --sizes-8: 8;

Example size tokens Open example figma file

Spacing

To create a spacing token, do the following:

  1. Create a Frame and name it _tokens/spacing
  2. Create another Frame, Rectangle or Main Component and set the padding properties to 10 in the auto layout.
  3. Name it spacing/10. Note, it is important to use the spacing/ prefix.

The token will be exported, if you convert it to css the output would be something like this:

  --spacing-10-top: 10;
  --spacing-10-right: 10;
  --spacing-10-bottom: 10;
  --spacing-10-left: 10;

Example spacing tokens Open example figma file

Borders

To create a border token, do the following:

  1. Create a Frame and name it _tokens/borders
  2. Create another Frame, Rectangle or Main Component and set the stroke property to your desired values.
  3. Name it borders/dashed-outside. Note, it is important to use the borders/ prefix.

The token will be exported, if you convert it to css the output would be something like this:

  --borders-dashed-outside-stroke-align: outside;
  --borders-dashed-outside-dash-pattern: 5,5,3,3;
  --borders-dashed-outside-stroke-cap: none;
  --borders-dashed-outside-stroke-join: miter;
  --borders-dashed-outside-stroke-miter-limit: 4;
  --borders-dashed-outside-stroke-weight: 1;
  --borders-dashed-outside-stroke: rgba(64, 255, 186, 1);

Radii

To create a radius token, do the following:

  1. Create a Frame and name it _tokens/radii
  2. Create another Frame, Rectangle or Main Component and set the radius properties to your desired values.
  3. Name it radii/same-with-smoothing. Note, it is important to use the radii/ prefix.

The token will be exported, if you convert it to css the output would be something like this:

  --radii-same-with-smoothing-radius: 5;
  --radii-same-with-smoothing-radius-type: single;
  --radii-same-with-smoothing-radii-top-left: 5;
  --radii-same-with-smoothing-radii-top-right: 5;
  --radii-same-with-smoothing-radii-bottom-right: 5;
  --radii-same-with-smoothing-radii-bottom-left: 5;
  --radii-same-with-smoothing-smoothing: 0.65;

Motion

Motion tokens are a combination of an easing curve, a duration and an animation type. To create a motion token follow this flow:

  1. Create a new Frame called _tokens/motion
  2. Create a new Frame, Component or Rectangle
  3. Name it motion/move-in. Note, it is important to use the motion/ prefix.
  4. Enter prototyping mode and link the element motion/move-in to any other element.
  5. Choose an animation type, easing curve and a duration

When exporting your tokens you will now get a set of properties for this motion set.

  --motion-move-in-type: move_in;
  --motion-move-in-duration: 0.5;
  --motion-move-in-easing: ease-in;
  --motion-move-in-easing-function-x-1: 0.41999998688697815;
  --motion-move-in-easing-function-x-2: 1;
  --motion-move-in-easing-function-y-1: 0;
  --motion-move-in-easing-function-y-2: 1;
  --motion-move-in-direction: left;

Available properties

To allow for maximum customizability I decided to provide all values that Figma provides. Many are not applicable to for example css but may be usable in other languages.

Colors are provided in rgba but can be converted using Amazon style dictionary.

Settings

Design Tokens plugin settings

Filename

This allows you to define the file name that is used when exporting tokens. The .json extension will be automatically appended to the name. The filename will also be send to the server when sending design tokens to the server.

Name Conversion

This option allows you to define how the token names will be converted when they are store in the json file, the available options are:

  • Default – spaces from the beginning and end are removed and the name is converted to lowercase
  • camelCase - spaces from the beginning and end are removed and the name is converted to camelCase
  • kebab-case - spaces from the beginning and end are removed and the name is converted to kebab-case

Prefix (used to in-/exclude styles)

Prefix

You can change the prefix from _ to anything, e.g. _tokens.

Exclude

The toggle allows you to switch from exclude to include mode. This means that only prefixed styles will be exported. For example if you only wanted to export styles that are named _tokens/....

Note: This setting only applies to Figma styles (colors, typography, grids & effects). It does not apply to custom tokens.

Push to Server

When a server url is specified, the command Send Design Tokens to Url will send a POST request to the provided url. The body of the request will look like the following:

  "event_type": "update-tokens", // or any string you defined
  "client_payload": { 
    "tokenFileName": "design-tokens.json", // this is the filename you define above
    "tokens": "{...}", // the stringified json object holding all your desing tokens
    "filename": "Design Tokens" // the Figma file name from which the tokens were exported
  }

Event type

This is the event_type property that is send in the body of the request with the client_payload.

Server url

The url the post request is send to. This must be SSL secured (using https) as Figma is a secure environment and thus does not allow non-secure requests. A limitation that comes with Figma is that the server must allow access from any origin and send the following header: Access-Control-Allow-Origin: *

Pushing to Github

If you push to github the server url must be in the format

https://api.github.com/repos/:username/:repo/dispatches

For the repositiory lukasoppermann/design-token-transformer this would be:

https://api.github.com/repos/lukasoppermann/design-token-transformer/dispatches

Auth header

This defines the authentication method used with the access token. The current choices are:

  • token (used for github)
  • bearer token
  • basic auth

Access token

The token send using the authentication method defined above. Learn more about creating a personal access token for github.

Github repo or custom server

You can use this feature to integrate tokens into your build pipeline. The ideal is to send tokens from Figma to a repository and automatically transform them. Depending on your setup you could either trigger a webhook on your product repos, create a new semversion on the tokens repo or notify the dev teams in another way.

To learn how to set this up using github and actions check out the documentation and code examples in the design token transformer repositry.

Roadmap & PRs

Roadmap

This plugin is under active development. You can find all planned features in the roadmap.

Feature requests & help

If you would like to see a specific feature implemented, please create an issue including a description of the feature and a use case.

If you can build the feature yourself and send a PR, this is even better. Please still create an issue first and mention that you want to implement it. I will get back to you asap to discuss the details of how to implement it.

Help develop this plugin

If you are interested in helping please comment on any issue you would like to take on. I will get back to you to discuss how to implement it.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].