# Design files

> Every field of the [design] table of sypnia.toml, tokens.json, gallery.yaml, the screen files and the icon rules.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://design.docs.sypnia.com/reference/files/

For agents: Settings: the [design] table of sypnia.toml (the project's one configuration file; top-level format = 1 and project): guide (version), prefix (CSS variable prefix, e.g. espiga), components {dir: src/design, framework: next|vite|astro}, languages [es, en], themes {light, dark, switch: bool}, checks {renders: local|cloud|off, first_screen_sizes, [[design.checks.waive]] {code, path, reason, until}}. Content files in design/, format 1: tokens.json: W3C Design Tokens ($type, $value, $description; dark values in $extensions.sypnia.dark); required groups color (roles), font (families, role.*), space, radius, border, shadow, motion (duration, easing), size (touch), layout (breakpoints, content). gallery.yaml: pieces[] {id, component, for, not_for, variants, states, combines_with, example}, combinations[] {id, pieces, for, rule}, patterns[] {id, for, regions, pieces, phone, desktop, states_required}. screens/<case-id>.screen.yaml: format, case, where, pattern, guide, status draft|approved|built, approved_by, approved_at, first_screen, regions, states, phone, desktop. icons/rules.yaml: grid 24, padding 2, stroke, cap round|square, join, radii[], signature {description, picture}, sizes [16,20,24]. JSON Schemas in spec/schemas/ of the engine repo; unknown fields kept and warned, x- prefix for your own.

The files in `design/` carry `format: 1` (except `tokens.json`, which follows the W3C Design Tokens format). Unknown fields are kept and reported as warnings; your own fields start with `x-`. The JSON Schemas are in the engine's repository, in `spec/schemas/`.

## The `[design]` table of `sypnia.toml`

Design's settings live in `sypnia.toml`, the one configuration file at the root of your repository that every Sypnia product shares. Design reads only its own `[design]` table, and the project's id from the top-level `project`:

`sypnia.toml (part)`

```toml
format = 1
project = "la-espiga"

[design]
guide = 4
prefix = "espiga"
components = { dir = "src/design", framework = "next" }
languages = ["es", "en"]
themes = { light = true, dark = true, switch = true }
```

| Field        | Type    | What it is                                                                                                                                |
| ------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `guide`      | integer | the current guide version                                                                                                                 |
| `prefix`     | string  | the CSS variable prefix (`espiga` → `--espiga-color-accent`)                                                                              |
| `components` | table   | `dir` (default `src/design`) and `framework` (`next`, `vite`, `astro`)                                                                    |
| `languages`  | list    | the app's languages, first is the main one                                                                                                |
| `themes`     | table   | `light`, `dark`, and `switch` (whether the app offers a switch)                                                                           |
| `checks`     | table   | `renders` (`local`, `cloud`, `off`), `first_screen_sizes`, and `[[design.checks.waive]]` entries (each `code`, `path`, `reason`, `until`) |

## `design/tokens.json`

W3C Design Tokens: each token has `$type` and `$value`, optionally `$description`; the dark value is in `$extensions["sypnia.dark"]`. Required groups:

| Group                                 | Holds                                                                                 |
| ------------------------------------- | ------------------------------------------------------------------------------------- |
| `color`                               | the [colour roles](https://design.docs.sypnia.com/guide/color-and-themes)             |
| `font`                                | families and `role.*` ([type roles](https://design.docs.sypnia.com/guide/typography)) |
| `space`, `radius`, `border`, `shadow` | [space and shape](https://design.docs.sypnia.com/guide/space-and-shape)               |
| `motion`                              | `duration.*`, `easing.*` ([motion](https://design.docs.sypnia.com/guide/motion))      |
| `size`                                | `touch` and other fixed sizes                                                         |
| `layout`                              | breakpoints and content widths                                                        |

## `design/gallery.yaml`

| List           | Fields                                                                                |
| -------------- | ------------------------------------------------------------------------------------- |
| `pieces`       | `id`, `component`, `for`, `not_for`, `variants`, `states`, `combines_with`, `example` |
| `combinations` | `id`, `pieces`, `for`, `rule`                                                         |
| `patterns`     | `id`, `for`, `regions`, `pieces`, `phone`, `desktop`, `states_required`               |

## `design/screens/<case-id>.screen.yaml`

| Field                                  | What it is                                                               |
| -------------------------------------- | ------------------------------------------------------------------------ |
| `format`, `case`, `where`              | the format, the case id, the place id in the navigation tree             |
| `pattern`, `guide`                     | the pattern followed and the guide version used                          |
| `status`, `approved_by`, `approved_at` | `draft`, `approved` or `built`, and the approval                         |
| `first_screen`                         | the main content fits without scrolling                                  |
| `regions`                              | region → list of `{ piece, variant?, text?, repeat? }`                   |
| `states`                               | `loading`, `empty`, `outcome.<name>`, `failure.<FailureName>`, `offline` |
| `phone`, `desktop`                     | how the layout changes                                                   |

## `design/icons/rules.yaml`

| Field                   | Example                                          |
| ----------------------- | ------------------------------------------------ |
| `grid`, `padding`       | `24`, `2`                                        |
| `stroke`, `cap`, `join` | `1.75`, `round`, `round`                         |
| `radii`                 | `[2.5, 9]` (the arcs allowed)                    |
| `sizes`                 | `[16, 20, 24]`                                   |
| `signature`             | `description` and `picture` of the brand's trait |
