DSDS quick start guide
Get started with DSDS — document structure, entry kinds, the section system, and minimal examples you can copy.
#
What is DSDS?DSDS (Design System Doc Spec) is a YAML format for documenting design systems. It helps document the how, when and why of a design system in a machine-readable format.
This quick start guide is here to help you write your first DSDS document. If a dummy like PJ can write one, you can as well.
The schema itself is written in JSON Schema, but the docs are written in YAML. All the validators that help you catch errors (like
#
What you get- Structured data: Every section has a defined structure to reduce ambiguity
- Machine-readable: Tools can parse, generate, validate, and transform it
- Portable: Say buh-bye to vendor lock-in
- Extensible: Add your own content and metadata without breaking compatibility
- Validatable: The schema catches errors before they reach consumers
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@ @@
@@ @@
@@ @@@@@@@@@@@ @@@@@@@@@@ @@
@@ @@ @@ @@ @@ @@
@@ @@ @@ @@ @@
@@ @@ @@ @@@@@@@@@@ @@
@@ @@ @@ @@ @@
@@ @@ @@ @@ @@ @@
@@ @@@@@@@@@@@ @@@@@@@@@@ @@
@@ @@
@@ @@@@@@@@@@@ @@@@@@@@@@ @@
@@ @@ @@ @@ @@ @@
@@ @@ @@ @@ @@
@@ @@ @@ @@@@@@@@@@ @@
@@ @@ @@ @@ @@
@@ @@ @@ @@ @@ @@
@@ @@@@@@@@@@@ @@@@@@@@@@ @@
@@ @@
@@ @@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ #
Document structureA DSDS document starts with a base:
#
The bare minimumThis is valid YAML, but it's not a valid DSDS document yet.
schemaVersion: "0.23.1"
name: Acme Design System #
Adding a system entryDSDS uses entries to describe pieces of the system—even the system itself. So the best entry to add first is a system. This entry allows you to document all system-level information (version, organization, url, license, platforms). It also gives you the freedom to document multiple systems in one document (if that's your kind of thing):
schemaVersion: "0.23.1"
name: Pizza Party Design System
entries:
- kind: system
id: pizza-party-design-system
name: Pizza Party Design System
description: The design system behind Pizza Party Super-time.
metadata:
status: {status: alpha}
organization: Pizza Party Super-time LLC
version: 0.1.0
platforms: [web-component] #
Adding more entriesOnce your system is documented, it's time to add other stuff—like a button. DSDS has a specific entry for components (
This is what your document would look like once a system and component are added.
schemaVersion: "0.23.1"
name: Pizza Party Design System
entries:
- kind: system
id: pizza-party-design-system
name: Pizza Party Design System
description: The design system behind Pizza Party Super-time.
metadata:
status: {status: alpha}
organization: Pizza Party Super-time LLC
version: 0.1.0
platforms: [web-component]
- kind: component
id: button
name: Button
description: Triggers an action.Every entry kind shares one open base —
Three fields on an entry point at other entries, and each one says what kind of link it is.
kind: component
id: dialog
name: Dialog
description: A window that asks for a decision before the person goes on.
uses:
- to: button
alternatives:
- to: popover
#
Splitting across files with It's cool to add all your content into one DSDS YAML file. But that's going to get big really fast. Most of you will want to break content up by entry—and the good news is that's easy.
DSDS has a
schemaVersion: "0.23.1"
name: Pizza Party Design System
entries:
- kind: system
id: pizza-party-design-system
name: Pizza Party Design System
description: The design system behind Pizza Party Super-time.
metadata:
status: {status: alpha}
organization: Pizza Party Super-time LLC
version: 0.1.0
platforms: [web-component]
refs:
- href: ./components/button.dsds.yaml
rel: file
role: Button component, documented in its own sibling file #
MetadataA few of the more common ones:
owner : An RFC 5322 mailbox for the responsible teamtags : Keywords for search and grouping. The schema treats the first tag as a categorysince : The version this entry was introducedgroup : A way to tie related entries together, likecolor.action on a family of tokens.status : Defines where an entry is in the system lifecycle (ex: beta, available, deprecated).
See common/metadata for the complete field list.
metadata:
status: {status: stable}
tags: [action, CTA, interactive]
owner: pj@pizzapartysupertime.com #
The section systemStructured docs live in the
Every section also carries a
#
Guidelines explain when and how to use an entrywhen-to-use : Describes when and when not to use the entryhow-to-use (default): Explains how to use the entry correctly
A fully-defined guideline acts as both guidance and a reference to test against. But it can also be as simple as a
kind: component
id: button
name: Button
description: >-
Triggers an action. Gives users a single, consistent way to trigger an action
across the product.
metadata:
tags: [actions, form]
status: {status: stable}
sections:
- kind: guidelines
for: all
items:
- level: should
statement: Limit each surface to one primary button.The
#
Definitions help you define terms or things in the systemA
sections:
- kind: definitions
for: all
title: Anatomy
context: anatomy
items:
- term: Container
definition: The interactive root element. Receives background, border, radius, and padding.
- term: Label
definition: The visible text of the button. #
Steps let you break down a process, guide, or checklistA
sections:
- kind: guidelines
for: all
items:
- id: aria-label-required
level: must
statement: Give an icon-only button an aria-label.
checkedBy: manual
checks:
- to: button#icon-only-buttons-have-an-aria-label
- kind: steps
for: agent
ordered: false
title: Self-check before shipping
items:
- title: Icon-only buttons have an aria-label #
Freeform lets you do your own thingEvery section can add a
sections:
- kind: section
for: all
title: Overview
freeform:
- title: About
body: Button is the primary interactive primitive in this design system. #
A component's own top-level fieldsA component is an opinionated kind of entry. And with that, it comes with specific properties to document a component. Here are the special properties it contains:
sourceFiles : Points to the component's source file. This pointer can be used for tools to extract the component's API. One entry per platform.imports : A code sample showing how to import the component. One entry per platform.traits : Describes every way the component can vary. A trait can be atraitType :variant (likesize: sm | md | lg ), orstate (likehover orloading ).combos : Helps describe acceptable and unacceptable pairing between traits, tokens, or entries (ex: "loading and disabled must not both be set").
Here's
sourceFiles:
- platform: react
file: ./src/Button.tsx
traits:
- id: tone
traitType: variant
kind: enum
name: Tone
description: The visual weight of the button.
values:
- id: default
description: Neutral. General-purpose actions.
- id: critical
description: Destructive or irreversible actions only.
- id: loading
traitType: state
kind: boolean
name: Loading
description: An async operation triggered by the button is in progress.
- id: hover
traitType: state
kind: boolean
name: Hover
description: Background darkens slightly when the pointer is over the button.
combos:
- subject: loading
level: should-not
items: [disabled]
note: Loading already makes the button non-interactive. #
Do your own thang #
kind: component
id: button
name: Button
description: Triggers an action.
$extensions:
com.figma:
context: Links this entry to its source Figma component for design-file lookups.
nodeId: "12:4045" #
Custom kindsWhen the generic
kind: acme.icon-library
id: material-icons
name: Material Icons
description: The icon set Acme's products ship with.See Extending the schema for a third option too — profiles, for making an existing kind's optional fields required on your own project — and for more on when to reach for each of the three.
#
Minimal examplesThese are close to the smallest valid entry for each kind. Copy one, fill in your content, and add
#
ComponentA minimal standalone component entry:
kind: component
id: button
name: Button
description: Triggers an action. #
TokenA token needs
kind: token
id: color.action.primary
name: Action Primary
description: The fill color for high-emphasis interactive surfaces.
tokenType: colorA described token adds
kind: token
id: color.action.primary
name: Action Primary
description: The fill color for high-emphasis interactive surfaces.
metadata:
status: {status: stable}
group: color.action
sections:
- kind: guidelines
for: all
items:
- level: must
statement: Pair with `color.surface.default` or `color.surface.raised` only — contrast is unverified on any other background.
tokenType: color
source: ./tokens.dtcg.json #
A pattern, using the generic entry kindA pattern, documented as a generic entry:
kind: entry
id: empty-state
name: Empty State
description: >-
A pattern shown in place of a list or grid that has no content yet. Tells the
user why an area is empty and what to do next, instead of leaving a blank
surface.
sections:
- kind: guidelines
for: all
framing: when-to-use
items:
- level: should
statement: Use an empty state the first time a user visits a list or grid that has no content yet. #
Sharing contentA lot of design system documentation covers the same topics—and you shouldn't have to rewrite it. Declare a rule, term, or step once and then point to it everywhere it applies with
The target can be an item in the base document's
schemaVersion: "0.23.1"
name: Pizza Party Design System
entries:
- kind: component
id: button
name: Button
description: Triggers an action.
sections:
- kind: guidelines
for: all
framing: when-to-use
items:
- level: should
statement: Use for an action the user takes on the current screen, like placing an order.
- kind: guidelines
for: all
items:
# Borrowed from another entry: the rule lives on the pattern
# that owns it, so it never had to move into `shared`.
- refs:
- to: order-confirmation#name-the-order
rel: same-as
- kind: guidelines
for: all
title: Accessibility
tags: [accessibility]
items:
# The tag identifies this section's topic. The shared rule
# supplies the statement and level without duplicating them.
- refs:
- to: shared-a11y#touch-target
rel: same-as
uses:
- to: order-confirmation
# A pattern, and the rule it owns. Several components follow this one.
- kind: entry
id: order-confirmation
name: Order Confirmation
description: The pattern for confirming an order before it reaches the kitchen.
sections:
- kind: guidelines
for: all
items:
- id: name-the-order
level: must
statement: The confirming action names what is being ordered, rather than just saying "OK".
checkedBy: manual
shared:
- id: shared-a11y
name: Shared Accessibility Rules
description: Cross-cutting accessibility rules, stated once and referenced from every entry they apply to.
sections:
- kind: guidelines
for: all
items:
- id: touch-target
level: must
statement: Minimum touch target 44x44px.
checkedBy: assistedThe button's accessibility section uses
#
Linking from proseWhen a description or a rule mentions another part of the system, link to it with a
<dsds:order-confirmation> shows the target's own name, "Order Confirmation", and stays right if it's renamed.[names what's being ordered](dsds:order-confirmation#name-the-order) shows your own words. Use this form for a guideline, which has no short name.
schemaVersion: "0.23.1"
name: Pizza Party Design System
entries:
- kind: component
id: button
name: Button
# <dsds:order-confirmation> shows as "Order Confirmation", the
# pattern's name, and stays right if the pattern is renamed.
description: Triggers an action. To confirm an order, follow <dsds:order-confirmation>.
sections:
- kind: guidelines
for: all
framing: when-to-use
items:
# A guideline has no short name, so this link writes its own text.
- level: should
statement: >-
Use to place an order on the current screen, with a label that
[names what's being ordered](dsds:order-confirmation#name-the-order).
# The link above only mentions the pattern. This pointer says the button
# follows it, which is what a tool reads to answer "what does this affect?"
uses:
- to: order-confirmation
- kind: entry
id: order-confirmation
name: Order Confirmation
description: The pattern for confirming an order before it reaches the kitchen. The confirming action is a <dsds:button>.
sections:
- kind: guidelines
for: all
items:
- id: name-the-order
level: must
statement: The confirming action names what is being ordered, rather than just saying "OK".
checkedBy: manualA link only mentions something. If the entry depends on what it mentions, say so with
#
Validate your documentEvery complete document on this page validates as written. The first one is deliberately partial (see above), and the snippets that show one part of an entry, like
#
Using the bundled schemaAdd
$schema: https://designsystemdocspec.org/v0.23.1/dsds.bundled.yaml
schemaVersion: "0.23.1"
name: My Design System
entries:
- kind: component
id: my-component
name: My Component
description: What this component is and does. #
Using the CLI# Clone the repo
git clone https://github.com/somerandomdude/design-system-documentation-schema.git
cd design-system-documentation-schema
npm install
# Validate the built-in examples and test corpus
npm run check
# Validate your own file
node scripts/validate/validate.js my-system.dsds.yaml #
Next stepsYou've seen the basics. Here's where to go deeper.
| Resource | Description |
|---|---|
| Full Spec | Complete schema reference for every field and constraint |
| Schema files | The raw |
| Example files | Complete, valid example documents for every entry and section kind |
| GitHub Discussions | Ask questions, share ideas, propose changes |
- Copy the minimal component example above
- Replace it with your own design system's first component
- Add
sections as your docs grow - Validate with
npm run check to catch schema errors early