Skip to content

[RFC] Format specification #1

Description

@kaelig

Principles

  • For core properties (name, value, description…), a design token file must be both human-editable and human-readable
  • The format is simple, extensible, and as unopinionated as possible
  • Vendors (design system tools, design tools…) can store information for their own usage, both globally and for each token
  • The format translates well to existing design tools, in order to facilitate adoption

v1 priorities

  1. Agreement and adoption by several design tools
  2. Define core use-cases

Inspiration


Proposal

At the moment, this proposal doesn't advocate for a particular file format (JSON, TypeScript…), it merely discusses what the shape of it should look like.

interface TokenList {
  // Where tokens are stored (in an array)
  tokens: Token[];
  // is this useful? should it be optional or not?
  version?: string;

  // Optional metadata
  data?: Data;

  // What other global properties are needed? (type, category, group…)
}
interface Token {
  name: string;
  value: any;
  description?: string;
  data?: Data;
  // What other properties are needed? (type, category, group…)
}
interface Data {
  // Vendor-prefixed data
  // for example: `data: { vendor: { "@sketch": {} } }`
  vendor?: object;

  // Any number of additional properties can live here,
  // for example, for storing additional information related to the token
}

Example

{
  tokens: [
    {
      name: 'Foo',
      value: 'Bar'
    },
    {
      name: 'I am a token',
      value: 'This is a value',
      description: 'A nice description.',
      data: {
        myOwnFlag: true,
        oneMoreThing: 'yay'
        vendor: {
          '@sketch': {
            // ...
          },
          '@figma': {
            // ...
          }
        }
      }
    }
  ],
  data: {
    vendor: {
      '@sketch': {
        // ...
      },
      '@figma': {
        // ...
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Feedback/ReviewOpen for feedback from the community, and may require a review from editors.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions