[community-group] Dimension type expanded unit types (#245)

drwpow has just created a new issue for https://github.com/design-tokens/community-group:

== Dimension type expanded unit types ==
In response to opening up `$type: dimension` tokens units and allow more than `px` and `rem`, there are 4 paths forward:

1. Don’t expand the list. `px` and `rem` forever.
2. Expand the list one-by-one. Every unit added must be reviewed and approved, and standardized.
3. Keep the unit types restricted, but allow an escape hatch.
4. Allow any unit; remove all restrictions and validation.

@romainmenke made an excellent argument against 4. And instead proposed a path forward for 3: keep the current list of valid units restricted, but add an escape hatch to allow vendor-specific units where needed. The following describes that escape hatch:

---

We should have a fixed set of specified units and allow any other unit as long as it is vendor prefixed.

Then there can't be conflicts between tools as those would be different vendors.
There also can't be conflicts between tools and future spec expansion.

It still leaves plenty of room for custom definitions.

Keep in mind that design token files are a carrier format.
How a unit is encoded in a file doesn't dictate how it is exposed in a design tool or the final output for developers.

Figma can create a custom unit `y` that is exposed to designers as `y` and output to developers as `y` while encoding it as `figma-y` in token files.

If a custom, vendor prefixed, unit is popular and gains adoption among other tools it is also a clear signal that it is useful. Such a custom unit should then go through the spec process to standardize it.

Instead of `figma-y` as the encoded unit it could also be a separate prop.

```json
{
  "value": 10,
  "unit": "y",
  "vendor": "figma"
}
```

_Originally posted by @romainmenke in https://github.com/design-tokens/community-group/issues/244#issuecomment-2294724417_
            

Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/245 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 17 August 2024 20:43:48 UTC