Skip to content

Commit b142f90

Browse files
committed
Adjust language in theme spec docs
1 parent b1f439b commit b142f90

File tree

2 files changed

+43
-10
lines changed

2 files changed

+43
-10
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: Design Graph
3+
---
4+
5+
# Design Graph
6+
7+
The core organizing principle for styles in Theme UI is based
8+
on a conceptual model called the *Design Graph*.
9+
10+
The Design Graph is composed of the following nodes:
11+
12+
- **Scales** are limited collections of raw values that map to specific style properties.
13+
For example, values for `font-size` are stored in the `fontSizes` scale.
14+
- **Components** are elements that have styles constrained by *scales*.
15+
- **Variants** are partial styles that map to specific components.
16+
For example, a button might have *primary* and *secondary* variants, or *large* and *small* variants.
17+
- **Themes** are collections of *scales* (and possibly *variants*) that encapsulate a particular visual design language.
18+
Ideally, themes follow a common interface (or schema) and can be swapped out in different implementations.
19+
20+
The Design Graph provides a way to think and talk about the styles in Theme UI, and the [Theme Specification][] is the interface.
21+
22+
To read more about the Design Graph, see the original [blog post][].
23+
24+
25+
[blog post]: https://jxnblk.com/blog/design-graph
26+
[theme specification]: /theme-spec

packages/docs/src/pages/theme-spec.mdx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ import ThemeScales from '../components/theme-scales'
66

77
# Theme Specification
88

9-
Theme UI is based on the [System UI Theme Specification][], with a few **optional** additions.
10-
The top-level naming convention used in the `theme` object come from this specification.
11-
Additionally, naming conventions for colors and typography are included
12-
to help ensure deeper interoperability with components from various other libraries.
13-
This is also intended to help ensure that themes created for Theme UI are suitable for white-label applications and general purpose theming.
9+
Theme UI is based on a theme specification, which can be used in other libraries and applications for increased interoperability.
10+
This specification is also intended to help ensure that themes created for Theme UI are suitable for white-label applications and general purpose theming.
1411

1512
The theme object is made up of the following data types:
1613

@@ -73,11 +70,6 @@ The `theme.colors` scale (i.e. color palette) should be an object literal with t
7370

7471
Other color keys can be added, including raw color values for aliasing the values above.
7572

76-
<!--
77-
## Aliasing Colors
78-
TK
79-
-->
80-
8173
## Color Modes
8274

8375
To use Theme UI color modes, color scales should include _at least_ a `text` and `background` color.
@@ -151,6 +143,8 @@ Font sizes are typically defined as an array, from smallest to largest.
151143
}
152144
```
153145

146+
Number values will be converted to pixel units. For other units, use string values, e.g. `'1em'`.
147+
154148
<Note>
155149

156150
Arrays are _not_ required, and plain objects will work as well.
@@ -252,6 +246,13 @@ The Theme UI `styles` object is primarily used as a way to style MDX content
252246
and helps avoid the need to use global CSS.
253247
The styles defined within this object can also be used with the [`Styled`](/styled) component.
254248

249+
<Note>
250+
251+
The `styles` object is essentially an MDX-specific *variant*
252+
that maps directly to each MDX component.
253+
254+
</Note>
255+
255256
The `theme.styles` object may include the following keys, which map to elements that can be rendered by markdown:
256257

257258
- `p` (paragraph)
@@ -332,6 +333,12 @@ Variants can also be used within the `theme.styles` object.
332333
}
333334
```
334335

336+
## Aliasing Colors and Other Scales
337+
338+
In many design systems, developers choose to create an additional layer of abstraction for mapping individual components to specific scale values.
339+
With Theme UI, *variants* are the mechanism to use for such abstractions.
340+
341+
335342
## Breakpoints
336343

337344
To configure the default breakpoints used in responsive array values, add a `breakpoints` array to your theme.

0 commit comments

Comments
 (0)