@monospaced/set-skills 0.25.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +163 -0
- package/README.md +35 -6
- package/package.json +4 -2
- package/src/set/SKILL.md +128 -0
- package/src/set-free/SKILL.md +47 -0
- package/src/set-loose/SKILL.md +47 -0
- package/src/set-strict/SKILL.md +70 -0
- package/src/compose-first/SKILL.md +0 -89
- package/src/custom-with-tokens/SKILL.md +0 -97
- /package/src/{custom-with-tokens → set-strict}/examples/stepper.md +0 -0
package/DESIGN.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
version: alpha
|
|
3
|
+
name: Monospaced
|
|
4
|
+
description: "Monospaced's visual brand identity, for use with Set."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Design
|
|
8
|
+
|
|
9
|
+
Principles for designing in Monospaced's visual brand identity: what to aim for, and why.
|
|
10
|
+
|
|
11
|
+
Use with [Set](https://set.monospaced.com), Monospaced's brand design system for digital experiences.
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
- Monospaced is a solo, independent UI consultancy: design systems, design engineering and front-end development.
|
|
16
|
+
_The brand speaks to clients and peers: people who know good design and engineering when they see it._
|
|
17
|
+
- Monospaced is named for monospaced type, every character the same width.
|
|
18
|
+
_The brand's design lineage starts here._
|
|
19
|
+
- Monospaced type carries many resonances. The obvious ones are in computing: terminals, code, early computers. Follow the thread back and it reaches the typewriter and concrete poetry. Monospace is also one of type's main families, so it brings typography, and through it graphic design, which grew up in print.
|
|
20
|
+
_The brand draws on all of it, not just the terminal._
|
|
21
|
+
- Early computers drew in two ways: text mode, a grid of characters, and graphics mode, a grid of bits.
|
|
22
|
+
_The brand's two fundamental units: the character cell and the pixel._
|
|
23
|
+
- Early computer art made pictures by rule: procedural graphics, drawn by code rather than by hand.
|
|
24
|
+
_The brand's graphics can be generated as well as drawn._
|
|
25
|
+
- A dither on screen and a halftone in print are one trick: tone from a pattern of marks.
|
|
26
|
+
_The brand keeps print beside the screen, or it becomes a terminal-themed website._
|
|
27
|
+
- The heritage is a material, never a costume.
|
|
28
|
+
_The brand has to look good to someone who doesn't catch the reference._
|
|
29
|
+
- The bar is visual impact, and the typesetting has to be right.
|
|
30
|
+
_The brand sells design, so the work must read as a designer's._
|
|
31
|
+
|
|
32
|
+
## Logo
|
|
33
|
+
|
|
34
|
+
- The logomark is built from Berkeley Mono's full character cell, beside a custom-kerned wordmark.
|
|
35
|
+
_The 1:2 cell, the text-mode pixel._
|
|
36
|
+
- The logo is never altered: not stretched, redrawn or recolored beyond its own variants.
|
|
37
|
+
_A mark is only recognisable if it's used consistently._
|
|
38
|
+
- Use the full lockup by default. The graphic logomark is for tight spaces, such as favicons and footers. The typographic variant is used sparingly, if at all, and the emblem rarely, mostly off screen, such as embroidered onto fabric.
|
|
39
|
+
_A flexible logo system: a variant for every use, so the logo never needs altering._
|
|
40
|
+
- A project's name starts as type: Berkeley Mono, set well. A crafted SVG wordmark can come later. Until then the type is the project's logo. When it links home, the link wraps it: it keeps its own color and takes no underline.
|
|
41
|
+
_Type gets a project a strong, on-brand mark straight away. A logo that turns link-colored reads as a text link._
|
|
42
|
+
|
|
43
|
+
## Colors
|
|
44
|
+
|
|
45
|
+
- The brand colors are cyan, magenta and yellow. Cyan leads, magenta interrupts, yellow is rarest.
|
|
46
|
+
_Cyan is early computing. Magenta and yellow complete CMY, from print: the move that took the brand out of the terminal. The brand tokens' descriptions encode the same order._
|
|
47
|
+
- The neutrals are tinted, never pure, both leaning to cyan. Pure black only where a medium demands it, such as video letterboxing.
|
|
48
|
+
_Keeps even the plainest screen in the brand's color._
|
|
49
|
+
- Brand color on text is for display and accents, used sparingly. Running text stays in the neutrals.
|
|
50
|
+
_Cyan is also the interactive color, so cyan text gets mistaken for a link._
|
|
51
|
+
|
|
52
|
+
## Typography
|
|
53
|
+
|
|
54
|
+
The principles of Swiss typography, set in a monospaced face: computing type, set by graphic design's rules.
|
|
55
|
+
|
|
56
|
+
- One typeface, Berkeley Mono, for all text, prose and display included.
|
|
57
|
+
_The brand is named for monospaced type, and Berkeley Mono carries the brand's resonances. Tightened word spacing and condensing at larger sizes let it carry prose and display as well as code._
|
|
58
|
+
- Each type style has a job. A difference in type means a difference in role. The exception is type working as a graphic, read for its form more than its words.
|
|
59
|
+
_With one variable typeface, endless variation is always available. Restraint is what makes a difference read as hierarchy._
|
|
60
|
+
- Importance comes from size, weight and space. Rules and boxes structure and divide; they don't signal importance.
|
|
61
|
+
_Swiss practice. Rules, rulers and printer's marks are welcome, as structure._
|
|
62
|
+
- Display size follows length: the shorter the text, the larger it can be set. The very largest sizes are for a word or two.
|
|
63
|
+
_Few characters fit at the largest sizes._
|
|
64
|
+
- Headings and display text never end in a full stop, and mostly avoid other punctuation, more so the larger the type.
|
|
65
|
+
_Every mark takes a full character width, so the gap around punctuation grows with the type._
|
|
66
|
+
- Numbers at display size take no thousands separator and no decimal point: round the figure, or set it smaller. At reading size and in data, numbers keep their separators and any decimals.
|
|
67
|
+
_The same gap, in the middle of a figure._
|
|
68
|
+
- Text is set flush left, ragged right. Centring is rare and justifying never.
|
|
69
|
+
_Swiss practice, and justified monospace opens uneven gaps._
|
|
70
|
+
- True monospace where the character grid matters: when things must line up, or when the grid is the point. Everything else reads with Set's tightened spacing.
|
|
71
|
+
_Text mode is the grid of characters. Showing it is the brand; forcing it on prose costs readability._
|
|
72
|
+
- No letterspacing.
|
|
73
|
+
_Tracking breaks the character grid, and Set already fits the type._
|
|
74
|
+
- No eyebrows: no small label above a heading, in any case.
|
|
75
|
+
_Now a signature of AI-generated design._
|
|
76
|
+
|
|
77
|
+
## Layout
|
|
78
|
+
|
|
79
|
+
What every screen is built on: the grid, the spacing scale and what space means.
|
|
80
|
+
|
|
81
|
+
- Everything sits on a grid: Set's columns across, the spacing scale down. Breaking the grid is a deliberate act, never an accident.
|
|
82
|
+
_Swiss practice: the grid makes order visible, so a break reads as intent._
|
|
83
|
+
- Space shows relationships: things that belong together sit closer than things that don't, so the gaps build the hierarchy. The same relationship gets the same space every time.
|
|
84
|
+
_Proximity, as in Swiss practice. Inconsistent gaps read as carelessness._
|
|
85
|
+
- White space is active: it's part of the composition, not what's left over. Density can contrast hard from one section to the next.
|
|
86
|
+
_Swiss practice._
|
|
87
|
+
|
|
88
|
+
## Composition
|
|
89
|
+
|
|
90
|
+
How each page or screen uses the grid and space: where the emphasis goes, how things balance, and where the grid is deliberately broken.
|
|
91
|
+
|
|
92
|
+
- Every page has a clear reading order: an obvious place to start, then a path through. Scale, weight, position and space set the order.
|
|
93
|
+
_Swiss practice. A page without an extreme still needs a start._
|
|
94
|
+
- Composition is asymmetric: elements balance across the grid rather than centre on it.
|
|
95
|
+
_Swiss practice._
|
|
96
|
+
- A field of strong color or an image is a structural block: it runs full bleed or meets the grid's lines, with any content on the grid inside it.
|
|
97
|
+
_Swiss practice._
|
|
98
|
+
- The container can be broken, deliberately: a bleed, or an element crossing columns.
|
|
99
|
+
_A centred column of stacked sections reads as a template._
|
|
100
|
+
|
|
101
|
+
## Imagery and graphics
|
|
102
|
+
|
|
103
|
+
- Brand images are photographs from the brand's own library, given the brand treatment made with [Screen](https://screen.monospaced.com) ([spec](https://github.com/monospaced/screen/blob/main/RECIPE.md)). Choose them as you would a poster subject: simple, bold, high contrast.
|
|
104
|
+
_One treatment makes every brand image look rendered on the same display. Our own photos, never stock._
|
|
105
|
+
- Graphics, from a mark, chart, diagram or ornament to a poster-scale composition, are drawn from the system's materials: type, glyphs, cells, dithers, color, lines and simple shapes. Drawn graphics are the second route to brand imagery, alongside the treated photograph.
|
|
106
|
+
_Early screens, print graphic design and early computer art made pictures from these same materials, so drawn graphics carry the brand's lineage._
|
|
107
|
+
- Crop with intent: tight and cut by the edge beats the whole thing centred. Images doing the same job share a ratio and treatment.
|
|
108
|
+
_Swiss practice. Scale and crop make an image active, and consistency lets difference mean something._
|
|
109
|
+
- Shading is made of square pixels, never smooth blends: two colors in an ordered pattern, with pixels big enough to see. No gradients, blurs or glows.
|
|
110
|
+
_Graphics mode: how early screens made tone._
|
|
111
|
+
- Halftones and overprinting interrupt: a print moment among the square pixels, not the base.
|
|
112
|
+
_Computing leads, and print is the counterpoint._
|
|
113
|
+
- Two units, one for each way of drawing. Drawing with characters uses the 1:2 character cell. Dithering uses the square pixel, even on type.
|
|
114
|
+
_The cell comes from the typeface, the pixel from early screens._
|
|
115
|
+
- Dithering works at any scale, from a full-bleed field to a small numeral.
|
|
116
|
+
_One treatment ties the biggest and smallest things together._
|
|
117
|
+
- Berkeley Mono's own glyphs, including its box-drawing and block characters, are a drawing kit.
|
|
118
|
+
_A large set of glyphs made for drawing, every one on the cell._
|
|
119
|
+
- Icons are TDesign. The exception is other brands' icons, used unaltered from a source such as Simple Icons.
|
|
120
|
+
_TDesign's square-leaning corners are closer to Berkeley Mono than the usual soft rounding. Someone else's mark isn't ours to restyle._
|
|
121
|
+
- Not every image is a brand image. An image that shows something specific, such as someone's work or someone's face, is shown as it is.
|
|
122
|
+
_Treating it would turn the thing itself into decoration._
|
|
123
|
+
- Text over a brand image always has contrast: the image follows the theme, or the image and its text are locked to one theme together. An image with no text over it can also use a mid tone, which suits both themes.
|
|
124
|
+
_Contrast is guaranteed by pairing, never by a scrim or shadow._
|
|
125
|
+
|
|
126
|
+
## Motion
|
|
127
|
+
|
|
128
|
+
- Motion never delays content: the page is usable from the first frame.
|
|
129
|
+
_A graphic drawing itself in is a bonus, not a gate._
|
|
130
|
+
- Graphics usually move by redrawing in steps, at a low frame rate: drawing themselves in once, or running a slow ambient loop.
|
|
131
|
+
_Graphics mode: an early screen redrawing. The motion is part of the look. Smooth motion is for graphics that need it, such as a responsive WebGL scene._
|
|
132
|
+
- Graphics can also respond: a lockup that wakes on hover, a graphic that follows the pointer.
|
|
133
|
+
_A graphic that answers the pointer rewards people who explore the page._
|
|
134
|
+
- Every moving graphic has a designed still, a finished image for when it stops or isn't allowed to move.
|
|
135
|
+
_Motion is optional, and the look must hold without it._
|
|
136
|
+
- Ambient motion is subtle, easy to ignore while reading.
|
|
137
|
+
_A loop that demands attention competes with the content._
|
|
138
|
+
- Layout moves only when someone acts on it, such as opening a panel. Nothing fades or slides in as the page loads or scrolls into view.
|
|
139
|
+
_Entrance choreography is a signature of generated design._
|
|
140
|
+
- Controls and changes of state move quickly and quietly: motion confirms what happened, it never performs.
|
|
141
|
+
_In the interface, motion is feedback, not expression._
|
|
142
|
+
|
|
143
|
+
## Interface
|
|
144
|
+
|
|
145
|
+
- Controls, forms and tables stay calm, dense and familiar.
|
|
146
|
+
_People use them to get things done, and expression there gets in the way._
|
|
147
|
+
- At most one action leads in a view or group, and the rest step back. A tool can be all quiet controls, with the work as the focus.
|
|
148
|
+
_A single leading action makes the next step obvious. When every action shouts, none does._
|
|
149
|
+
- Empty, loading and error states are designed: each says what happened and what to do next.
|
|
150
|
+
_Most product screens spend time in these states, so they're part of the design, not an afterthought._
|
|
151
|
+
- Rounding is subtle and sparing: radii of 1 to 6px. Circles are for things that are round by convention, such as avatars, radio buttons and step markers, used sparingly.
|
|
152
|
+
_To pair with Berkeley Mono's and TDesign's square-leaning corners, without being rigid._
|
|
153
|
+
- Things that sit above the page, such as cards and images, can take one subtle shadow, never an elevation system. An offset stroke, an outline shifted slightly off the box toward the top left, is another small lift.
|
|
154
|
+
_A little lift shows what sits above the page, without drawing attention to itself. The offset stroke comes from print misregistration._
|
|
155
|
+
|
|
156
|
+
## Clichés
|
|
157
|
+
|
|
158
|
+
- Avoid stock phrasing: "seamless", "elevate", "unlock", "it's not X, it's Y". Write plain, specific copy.
|
|
159
|
+
_Stock phrasing reads as generated, and people notice._
|
|
160
|
+
- Avoid obvious references: blinking cursors, typewriter effects, fake terminals, scanline overlays, green on black, pixel fonts, puns on the name.
|
|
161
|
+
_These dress the page up as old computing instead of drawing on it: the heritage as a costume, not a material._
|
|
162
|
+
- Avoid template patterns: icon-title-sentence triples, centred hero with two buttons, gradient text, soft blobs, emoji, bento grids, alternating image-and-text sections, three pricing tiers with one highlighted, numbered sections without a real order.
|
|
163
|
+
_These are the defaults of templates and generated sites, so they make a page look like everyone else's._
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# @monospaced/set-skills
|
|
2
2
|
|
|
3
|
-
Markdown guardrails for AI coding agents (and humans) building sites and apps with Set.
|
|
3
|
+
Markdown guardrails for AI coding agents (and humans) building sites and apps with Set: the `set` skill, a skill for each of Set's three modes, and `DESIGN.md`.
|
|
4
4
|
|
|
5
5
|
Each skill is a folder containing a `SKILL.md` (with `name` and `description` frontmatter) plus optional sibling `examples/`, `references/`, and `assets/` folders. The shape is shared by Claude Code and OpenAI Codex, so authoring vendor-neutral skills works in both.
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ Each skill is a folder containing a `SKILL.md` (with `name` and `description` fr
|
|
|
8
8
|
|
|
9
9
|
These skills are companion content for the Set design system: `@monospaced/set-{core,assets,config,tokens}` (and `@monospaced/set-react` for React projects), serving the **Monospaced** brand.
|
|
10
10
|
|
|
11
|
-
- **Compositional** — components encode design choices in their props; consumers compose UI from the system's vocabulary
|
|
11
|
+
- **Compositional** — components encode design choices in their props; consumers compose UI from the system's vocabulary, and custom CSS takes its values from tokens.
|
|
12
12
|
- **Multi-context** — tokens resolve under theme (light / dark), brand, and surface context automatically.
|
|
13
13
|
- **Brand contexts**:
|
|
14
14
|
- `mnsp` — the public-facing Monospaced brand.
|
|
@@ -16,7 +16,27 @@ These skills are companion content for the Set design system: `@monospaced/set-{
|
|
|
16
16
|
- `base` — structural foundation layer. Not a brand; consumers don't pick it.
|
|
17
17
|
- **Voice (for content, copy, and naming decisions)** — calm, business-like, time-less; organised and precise.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
## What ships
|
|
20
|
+
|
|
21
|
+
| File | What it is |
|
|
22
|
+
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| `set/SKILL.md` | The rules that apply in every mode: setup, components, tokens, CSS architecture, accessibility, layout, type, color, motion, imagery, lint and visual review. |
|
|
24
|
+
| `set-strict/SKILL.md` | Strict mode. Its `examples/stepper.md` fills a gap with the system; it is generated from the playground's stepper, so the code an agent copies builds, type-checks and passes lint. |
|
|
25
|
+
| `set-loose/SKILL.md` | Loose mode. |
|
|
26
|
+
| `set-free/SKILL.md` | Free mode. |
|
|
27
|
+
| `DESIGN.md` | Monospaced's visual brand identity: what to aim for, and why. Every mode judges the work against it. |
|
|
28
|
+
|
|
29
|
+
## Modes
|
|
30
|
+
|
|
31
|
+
A project picks one mode as its default. The modes differ in where custom markup and CSS may be used instead of a Set component. Each allows everything the one before it does, so work in one mode is always valid in the modes after it.
|
|
32
|
+
|
|
33
|
+
- **Strict** composes with Set's components. Custom markup and CSS only where no Set component meets the need: a component Set doesn't have, a block that switches arrangement at its own width, a one-token optical adjustment. For product UI, tools and anything that should look like Set out of the box.
|
|
34
|
+
- **Loose** adds custom layout and expression on tokens. A page can be laid out in custom CSS Grid rather than `Grid`, display type can be styled in custom CSS rather than `Heading`, fluid or fit to its container's width, and graphics in SVG, canvas and WebGL step on Set's frame tokens. Controls, navigation and status still come from Set. For marketing pages, editorial layouts and anything with expressive type and graphics.
|
|
35
|
+
- **Free** adds any weight, width and slant on the font's axes, overlaps, custom controls and any timing for graphics. Custom markup and CSS is on a par with Set components everywhere. For posters, experiments and work where the brand is the subject.
|
|
36
|
+
|
|
37
|
+
Every mode shares the same floor: the `set` skill's rules, Set's Stylelint config, and `DESIGN.md`. A mode changes how much is built outside Set's components, never how good the result has to be.
|
|
38
|
+
|
|
39
|
+
Only one mode applies at a time. With more than one mode skill installed, an agent follows a mode named in the request, then the mode skill in the folder it's working in, then the project's default mode from its agent instructions.
|
|
20
40
|
|
|
21
41
|
## Install
|
|
22
42
|
|
|
@@ -24,16 +44,25 @@ The operational skills below cover _how_ to use the system; this section is just
|
|
|
24
44
|
pnpm add -D @monospaced/set-skills
|
|
25
45
|
```
|
|
26
46
|
|
|
47
|
+
`pnpm create @monospaced/set` does the rest of this section for you: it installs the skills and `DESIGN.md`, asks which mode should be the default, and writes it into `CLAUDE.md` and `AGENTS.md`.
|
|
48
|
+
|
|
27
49
|
## Use
|
|
28
50
|
|
|
29
|
-
Copy or symlink the skill folders this package ships into your agent's discovery directory:
|
|
51
|
+
Copy or symlink the skill folders this package ships into your agent's discovery directory, and `DESIGN.md` into the project root:
|
|
30
52
|
|
|
31
53
|
- **Claude Code** → `.claude/skills/`
|
|
32
54
|
- **OpenAI Codex** → `.agents/skills/`
|
|
33
55
|
|
|
34
56
|
```sh
|
|
35
|
-
# Example: install all skills for Claude Code
|
|
57
|
+
# Example: install all skills and DESIGN.md for Claude Code
|
|
36
58
|
cp -r node_modules/@monospaced/set-skills/src/* .claude/skills/
|
|
59
|
+
cp node_modules/@monospaced/set-skills/DESIGN.md .
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Then name the default mode in the project's agent instructions (`CLAUDE.md`, `AGENTS.md`), with a line to load `set` before writing UI:
|
|
63
|
+
|
|
64
|
+
```md
|
|
65
|
+
Built with Set. Load the `set` skill before writing any UI. The default mode is strict.
|
|
37
66
|
```
|
|
38
67
|
|
|
39
68
|
Refer to your agent's documentation for the canonical discovery paths.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monospaced/set-skills",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Markdown guardrails for AI coding agents (and humans) building sites and apps with Set.",
|
|
3
|
+
"version": "0.26.0",
|
|
4
|
+
"description": "Markdown guardrails for AI coding agents (and humans) building sites and apps with Set: the set skill, a skill for each mode, and DESIGN.md.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/monospaced/set.git",
|
|
@@ -10,10 +10,12 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
"./package.json": "./package.json",
|
|
13
|
+
"./DESIGN.md": "./DESIGN.md",
|
|
13
14
|
"./*": "./src/*"
|
|
14
15
|
},
|
|
15
16
|
"files": [
|
|
16
17
|
"src",
|
|
18
|
+
"DESIGN.md",
|
|
17
19
|
"README.md"
|
|
18
20
|
],
|
|
19
21
|
"devDependencies": {
|
package/src/set/SKILL.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: set
|
|
3
|
+
description: "The rules for Set that apply in every mode: strict, loose and free. Use when working on UI built with @monospaced/set-core or @monospaced/set-react, alongside the active mode skill."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Set
|
|
7
|
+
|
|
8
|
+
Set is Monospaced's brand design system for digital experiences. It has three modes: strict, loose and free. They differ in how much custom markup and CSS they allow. Read the project's DESIGN.md before designing anything: it describes the visual brand identity. This skill sets out the rules that apply in every mode.
|
|
9
|
+
|
|
10
|
+
## Modes
|
|
11
|
+
|
|
12
|
+
Compose with Set's components, and use tokens for any custom CSS. The modes differ in where custom markup and CSS may be used:
|
|
13
|
+
|
|
14
|
+
1. **Strict:** only where no Set component meets the need.
|
|
15
|
+
2. **Loose:** also for layout and expression, wherever that fits better than a Set component.
|
|
16
|
+
3. **Free:** anywhere that fits better than a Set component.
|
|
17
|
+
|
|
18
|
+
Each mode allows everything the one before it does, so work in one mode is always valid in the modes after it.
|
|
19
|
+
|
|
20
|
+
Only one mode applies at a time. If the project has more than one mode skill, decide which to use in this order:
|
|
21
|
+
|
|
22
|
+
1. A mode named in the request.
|
|
23
|
+
2. The mode skill in the folder you're working in.
|
|
24
|
+
3. The project's default mode, from its agent instructions.
|
|
25
|
+
|
|
26
|
+
If a request names a mode the project doesn't have, stay in an installed mode and say so.
|
|
27
|
+
|
|
28
|
+
## Building with Set
|
|
29
|
+
|
|
30
|
+
### Setup
|
|
31
|
+
|
|
32
|
+
- **`Root` wraps everything.** It sets the brand and theme, carries language and direction, and emits the `.set` scope every component's CSS targets. Without it, components render unstyled. Set `appRoot` when Set owns the whole page. Omit it when Set is embedded in part of a non-Set page.
|
|
33
|
+
- **`Surface` sets color context.** Wrap a region in `Surface`, or use a component's `surface` prop where available, to switch context for everything inside. Color then resolves correctly for that surface in light and dark themes.
|
|
34
|
+
|
|
35
|
+
### Components
|
|
36
|
+
|
|
37
|
+
`@monospaced/set-core` exports a spec for every component, such as `SET_BUTTON_SPEC`: what the component is for, the element it renders, and each prop with its type, default and description. Read a component's spec before using it. [Storybook](https://set.monospaced.com/storybook) shows them live.
|
|
38
|
+
|
|
39
|
+
### Tokens
|
|
40
|
+
|
|
41
|
+
`@monospaced/set-config/set.catalog.css` lists every `--set-*` token, with its `$description` as a comment. Its values are for the default context only. How a token varies by context, such as theme or viewport size, is in Set's token JSON: `@monospaced/set-tokens/mnsp` and `@monospaced/set-tokens/base`.
|
|
42
|
+
|
|
43
|
+
The `$description` confirms the intent: read it before using a token whose name sounds right. Use a token of the right kind for each property: never a horizontal spacing token for vertical space, for example.
|
|
44
|
+
|
|
45
|
+
### CSS architecture
|
|
46
|
+
|
|
47
|
+
Custom CSS sits alongside Set's own:
|
|
48
|
+
|
|
49
|
+
```css
|
|
50
|
+
:where(.set) .app-step-indicator {
|
|
51
|
+
/* base styles */
|
|
52
|
+
|
|
53
|
+
.step {
|
|
54
|
+
/* descendant styles */
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- **Scope to `:where(.set)`.** It matches inside a `Root` and adds no specificity, the same as Set's own rules.
|
|
60
|
+
- **Leave your CSS unlayered.** Set's styles live in the `set` cascade layer (`set.brand`, `set.root`, `set.components`), so unlayered CSS wins over them without specificity fights.
|
|
61
|
+
- **Prefix your classes** (`.app-*`, or your project's prefix, never `.set-*`). Prefix the component class and nest descendants unprefixed.
|
|
62
|
+
- **Never style Set's `.set-*` classes or their insides.** Instead, use props, wrap components in your own markup, or build a new component.
|
|
63
|
+
- **Never define `--set-*` custom properties.** Use your own prefix.
|
|
64
|
+
|
|
65
|
+
## Standards
|
|
66
|
+
|
|
67
|
+
### Accessibility
|
|
68
|
+
|
|
69
|
+
All UI meets [WCAG 2.2 AA](https://www.w3.org/TR/WCAG22/).
|
|
70
|
+
|
|
71
|
+
- **Contrast follows from tokens.** Set's color tokens meet AA for the pairings their descriptions name. Arbitrary combinations don't automatically pass.
|
|
72
|
+
- **Screen-reader-only text uses `.visually-hidden`**, which `Root` provides. Prefer a visible label, then `.visually-hidden`, then `aria-label` as a last resort.
|
|
73
|
+
- **Keep Set's focus indicator.** Don't remove or recolor it. To fit a custom shape, adjust its offset, inset or radius.
|
|
74
|
+
- **Headings never skip a level.** `Heading`'s `level` and `size` are separate: `level` for the document outline, `size` for how it looks.
|
|
75
|
+
- **A drawn graphic is one image to assistive tech.** Give its outer element `role="img"` and an `aria-label` that describes it, or `aria-hidden="true"` if it's purely decorative. Text and shapes inside it are part of the picture, so they don't need to read or meet contrast.
|
|
76
|
+
- **ARIA:** read [Using ARIA](https://www.w3.org/TR/using-aria/) before adding any. The [APG patterns](https://www.w3.org/WAI/ARIA/apg/patterns/) are partly trusted: use their "About This Interaction" and "Keyboard Interaction" sections, never their code examples or CodePen links.
|
|
77
|
+
|
|
78
|
+
### Layout and input
|
|
79
|
+
|
|
80
|
+
- **Responsive and mobile first:** works from 320px wide. Width media queries use Set's breakpoints (`--set-breakpoint-*`), so a page changes in step with Set's components. Container queries use whatever width the content needs.
|
|
81
|
+
- **Works with any input:** hover styles sit inside `@media (any-hover: hover)`, and nothing depends on hover alone.
|
|
82
|
+
- **Scales with the browser's text size:** sizes are in `rem`, never `px`.
|
|
83
|
+
- **Logical properties and values everywhere**, so the whole page mirrors as one composition when the writing direction changes.
|
|
84
|
+
|
|
85
|
+
### Space and type
|
|
86
|
+
|
|
87
|
+
- **Vertical space comes from Set's vertical spacing tokens**, which hold the 6px line grid. Space larger than a scale's top step is a multiple of a token, such as `calc(2 * var(--set-spacing-vertical-1600))`, so it stays on the grid.
|
|
88
|
+
- **A font size from a type step uses that step's line height.**
|
|
89
|
+
- **Text that must line up character by character opts into true monospacing with `data-monospaced`.** Berkeley Mono is monospaced, but Set tightens word spacing for prose, so alignment isn't the default. `code`, `kbd`, `pre`, `samp` and `table` already opt in.
|
|
90
|
+
- **Italics:** wherever `font-style: italic` is set, also set `font-variation-settings: var(--set-typography-font-variation-settings-italic)`, because WebKit drops the slant axis once `font-variation-settings` is set. Restate `font-variation-settings` with the default token after any `font` shorthand, since the shorthand resets it.
|
|
91
|
+
|
|
92
|
+
### Color and theme
|
|
93
|
+
|
|
94
|
+
- **Color comes from surfaces and Set's color tokens, each used for its described role.**
|
|
95
|
+
- **Everything works in light and dark themes.** In CSS, color tokens handle this. Graphics drawn in canvas or WebGL read the tokens again and redraw when the theme changes.
|
|
96
|
+
- **Theme follows the user's preference (`prefers-color-scheme`) by default.** To offer a theme switch on the page, use Set's `Lightswitch`, but only when it can be kept permanently in view, such as in a fixed or sticky header.
|
|
97
|
+
- **Theme changes color, never layout.** Nothing moves or resizes between light and dark.
|
|
98
|
+
|
|
99
|
+
### Motion
|
|
100
|
+
|
|
101
|
+
- **Under `prefers-reduced-motion`, nothing moves.** Where the motion carries meaning, a non-moving change, such as a fade, can stand in. Canvas and WebGL don't get this for free: check the preference and render the designed still.
|
|
102
|
+
|
|
103
|
+
### Imagery
|
|
104
|
+
|
|
105
|
+
- **Brand images are treated photographs or drawn graphics.** Photographs are treated with [Screen](https://screen.monospaced.com): ask the user for them, and never fetch stock. Drawn graphics you can make yourself. Never use an untreated photo as a brand image, and never imitate the treatment with CSS filters.
|
|
106
|
+
- **Text over a treated photograph:** use `Poster`. An adaptive image follows the theme by itself. Otherwise, lock the content to the image with `contentTheme`: `dark` for a dark image, `light` for a light one. A mid-tone image has no contrast guarantee for text.
|
|
107
|
+
- **Screen exports scale smoothly.** Never apply `image-rendering: pixelated` to them: on a fluid image it causes moiré. One export is fine. Several, served through `Image` as width-keyed sources, can keep the dot size between about 0.75 and 2.25 CSS px as the image grows.
|
|
108
|
+
- **Dithered type or shapes:** mask the element with a `--set-shape-dither-*-image` token and the matching `--set-shape-dither-tile-*` size, keeping the real text in the DOM. The smaller the type, the smaller the cell, so it still reads. It suits short text read at a glance, never running text.
|
|
109
|
+
- **Graphics performance:** keep the work per frame low, pause when off-screen or hidden, and redraw only when something changes. Draw crisp pixel graphics at device resolution, with cells a whole number of device pixels, redrawing on resize.
|
|
110
|
+
|
|
111
|
+
## Checks
|
|
112
|
+
|
|
113
|
+
### Lint
|
|
114
|
+
|
|
115
|
+
Set's Stylelint config is the same in every mode.
|
|
116
|
+
|
|
117
|
+
- **Fix lint errors, or report them if you can't.**
|
|
118
|
+
- **Never work around a rule**, for example by moving a value where lint can't see it.
|
|
119
|
+
- **Only add a disable comment with the user's approval**, even where the code already has some.
|
|
120
|
+
|
|
121
|
+
### Visual review
|
|
122
|
+
|
|
123
|
+
Rules can all be followed and the page still look wrong. Look at the work in a browser after each section or significant change, not just at the end, and iterate on what you see.
|
|
124
|
+
|
|
125
|
+
- Across a range of viewport widths, including the narrowest.
|
|
126
|
+
- Every section, not just the top of the page.
|
|
127
|
+
- Judge it against the project's DESIGN.md, and redo any section that falls short.
|
|
128
|
+
- No console errors.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: set-free
|
|
3
|
+
description: "The rules for Set's free mode: compose with Set's components, and also use custom markup and CSS anywhere that fits better. Use with the set skill when free is the active mode."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Free mode
|
|
7
|
+
|
|
8
|
+
Free is for expressive work. Where the request leaves room, reach for what only free allows, held to DESIGN.md's restraint.
|
|
9
|
+
|
|
10
|
+
## Anywhere
|
|
11
|
+
|
|
12
|
+
Custom markup and CSS is on a par with Set components everywhere: use whichever fits better.
|
|
13
|
+
|
|
14
|
+
## Materials
|
|
15
|
+
|
|
16
|
+
### Layout and space
|
|
17
|
+
|
|
18
|
+
- **Layout** comes from Set's layout components, or custom markup and CSS.
|
|
19
|
+
- **Vertical space** comes from component props, or vertical spacing tokens.
|
|
20
|
+
- **Horizontal space** comes from component props, horizontal spacing tokens, or the character cell (`ch`).
|
|
21
|
+
- **Breakpoints and container queries** live inside components, or in custom CSS.
|
|
22
|
+
- **Asymmetry** comes from `Grid` spans, or custom markup and CSS.
|
|
23
|
+
- **Bleeds** come from Set's layout components, or custom markup and CSS.
|
|
24
|
+
- **Overlaps:** in components built for layering, such as `Poster`, or with custom markup and CSS. Text meant to be read still needs contrast against anything it overlaps.
|
|
25
|
+
|
|
26
|
+
### Type
|
|
27
|
+
|
|
28
|
+
- **Font size** comes from components, or type composites and type steps. For display type, it can also be fluid between any two type steps, or fit to its container's width. The line height for each:
|
|
29
|
+
- **Fluid:** runs between the two steps' line heights, rounded up to the 6px grid.
|
|
30
|
+
- **Fit to width:** line height 1, with the type on one line or broken by hand, and any space above and below from vertical spacing tokens.
|
|
31
|
+
- **Weight and width** come from components, type tokens, or any value on the font's axes.
|
|
32
|
+
- **Slant** comes from semantic elements in copy, such as `em` and `cite`, `font-style: italic`, or any angle on the font's slant axis, set with `'slnt'` in `font-variation-settings`.
|
|
33
|
+
|
|
34
|
+
### Color
|
|
35
|
+
|
|
36
|
+
- **Color comes from components and surfaces**, or color tokens.
|
|
37
|
+
|
|
38
|
+
### Graphics and motion
|
|
39
|
+
|
|
40
|
+
- **SVG, canvas and WebGL** are fine.
|
|
41
|
+
- **Motion** comes from components, or motion tokens. Graphics can use any timing.
|
|
42
|
+
- **Images and video** use `Image` and `Video`, or raw elements.
|
|
43
|
+
|
|
44
|
+
### Components
|
|
45
|
+
|
|
46
|
+
- **Layout, structure, typographic and graphic components:** Set components or custom, whichever fits.
|
|
47
|
+
- **Control, navigation and status components:** Set components or custom, whichever fits.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: set-loose
|
|
3
|
+
description: "The rules for Set's loose mode: compose with Set's components, and also use custom markup and CSS for layout and expression wherever that fits better. Use with the set skill when loose is the active mode."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Loose mode
|
|
7
|
+
|
|
8
|
+
Loose is for work with expressive layout, type and graphics. Where the request leaves room, use that freedom rather than defaulting to Set components.
|
|
9
|
+
|
|
10
|
+
## Layout and expression
|
|
11
|
+
|
|
12
|
+
For layout and expression, custom markup and CSS is on a par with Set components: use whichever fits better. For example, a page can be laid out in custom CSS Grid rather than `Grid` and `GridItem`, and a display heading can be styled in custom CSS rather than with `Heading`.
|
|
13
|
+
|
|
14
|
+
## Materials
|
|
15
|
+
|
|
16
|
+
### Layout and space
|
|
17
|
+
|
|
18
|
+
- **Layout** comes from Set's layout components, or custom markup and CSS.
|
|
19
|
+
- **Vertical space** comes from component props, or vertical spacing tokens.
|
|
20
|
+
- **Horizontal space** comes from component props, or horizontal spacing tokens.
|
|
21
|
+
- **Breakpoints and container queries** live inside components, or in custom CSS.
|
|
22
|
+
- **Asymmetry** comes from `Grid` spans, or custom markup and CSS.
|
|
23
|
+
- **Bleeds** come from Set's layout components, or custom markup and CSS.
|
|
24
|
+
- **Overlaps:** none, except in components built for layering, such as `Poster`.
|
|
25
|
+
|
|
26
|
+
### Type
|
|
27
|
+
|
|
28
|
+
- **Font size** comes from components, or type composites and type steps. For display type, it can also be fluid between any two type steps, or fit to its container's width. The line height for each:
|
|
29
|
+
- **Fluid:** runs between the two steps' line heights, rounded up to the 6px grid.
|
|
30
|
+
- **Fit to width:** line height 1, with the type on one line or broken by hand, and any space above and below from vertical spacing tokens.
|
|
31
|
+
- **Weight and width** come from components or type tokens. At 28px (type step 600) and up, any weight token can pair with any width token.
|
|
32
|
+
- **Slant** comes from semantic elements in copy, such as `em` and `cite`, or `font-style: italic`.
|
|
33
|
+
|
|
34
|
+
### Color
|
|
35
|
+
|
|
36
|
+
- **Color comes from components and surfaces**, or color tokens.
|
|
37
|
+
|
|
38
|
+
### Graphics and motion
|
|
39
|
+
|
|
40
|
+
- **SVG, canvas and WebGL** are fine.
|
|
41
|
+
- **Motion** comes from components, or motion tokens. Graphics step on frame tokens (`--set-motion-frame-*`).
|
|
42
|
+
- **Images and video** use `Image` and `Video`, or raw elements.
|
|
43
|
+
|
|
44
|
+
### Components
|
|
45
|
+
|
|
46
|
+
- **Layout, structure, typographic and graphic components:** Set components or custom, whichever fits.
|
|
47
|
+
- **Control, navigation and status components:** Set components first, custom only for a gap.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: set-strict
|
|
3
|
+
description: "The rules for Set's strict mode: compose with Set's components, and use custom markup and CSS only where no Set component meets the need. Use with the set skill when strict is the active mode."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Strict mode
|
|
7
|
+
|
|
8
|
+
## Compose first
|
|
9
|
+
|
|
10
|
+
Nest Set components in whatever combination the content needs:
|
|
11
|
+
|
|
12
|
+
- **Pages:** `Page`, with its `header`, `children` (main) and `footer` slots assembled from components. The optional `banner` slot takes a `Banner`.
|
|
13
|
+
- **Bounded content:** `Container` at page level, never a custom max-width wrapper.
|
|
14
|
+
- **Main content layout:** `Grid` and `GridItem` for responsive multi-column layout.
|
|
15
|
+
- **Groups:** `Stack` for vertical and `Inline` for horizontal, spaced with `gap`, never custom margins or flex.
|
|
16
|
+
- **Insets and boundaries:** `Box` insets content at any level, such as around a `Grid` for section padding or around a `Stack` inside a `GridItem`.
|
|
17
|
+
- **Text:** `Heading` and `Text` for copy you compose, `Prose` for rich text, such as markdown rendered with `@monospaced/set-markdown`.
|
|
18
|
+
- **Everything else:** the matching Set component. Check the specs before writing raw HTML.
|
|
19
|
+
|
|
20
|
+
## When no Set component meets the need
|
|
21
|
+
|
|
22
|
+
This is a gap. Gaps can be large or small. For example:
|
|
23
|
+
|
|
24
|
+
- A component Set doesn't have, such as a stepper.
|
|
25
|
+
- A self-contained block that switches arrangement at its own width, such as a media object that stacks when narrow.
|
|
26
|
+
- A small adjustment, such as a wrapper adding one spacing token to correct an optical alignment.
|
|
27
|
+
|
|
28
|
+
Before using custom markup and CSS, check for a Set component or prop you missed. Many apparent gaps go away on a second look.
|
|
29
|
+
|
|
30
|
+
Fill a gap with the system:
|
|
31
|
+
|
|
32
|
+
1. Use Set components wherever they fit, including inside custom markup.
|
|
33
|
+
2. Use custom markup and CSS only for the parts no Set component covers.
|
|
34
|
+
|
|
35
|
+
The stepper example, `@monospaced/set-skills/set-strict/examples/stepper.md`, fills a gap this way.
|
|
36
|
+
|
|
37
|
+
If filling a gap takes a lot of custom markup and CSS, tell the user: Set may benefit from a new component.
|
|
38
|
+
|
|
39
|
+
## Materials
|
|
40
|
+
|
|
41
|
+
### Layout and space
|
|
42
|
+
|
|
43
|
+
- **Layout** comes from Set's layout components, or custom markup and CSS for a gap.
|
|
44
|
+
- **Vertical space** comes from component props, or vertical spacing tokens for a gap.
|
|
45
|
+
- **Horizontal space** comes from component props, or horizontal spacing tokens for a gap.
|
|
46
|
+
- **Breakpoints and container queries** live inside components, or in custom CSS for a gap.
|
|
47
|
+
- **Asymmetry** comes from `Grid` spans.
|
|
48
|
+
- **Bleeds** come from Set's layout components, or custom markup and CSS for a gap.
|
|
49
|
+
- **Overlaps:** none, except in components built for layering, such as `Poster`.
|
|
50
|
+
|
|
51
|
+
### Type
|
|
52
|
+
|
|
53
|
+
- **Font size** comes from components, or type composites and type steps for a gap.
|
|
54
|
+
- **Weight and width** come from components, or type tokens for a gap.
|
|
55
|
+
- **Slant** comes from semantic elements in copy, such as `em` and `cite`, or `font-style: italic` for a gap.
|
|
56
|
+
|
|
57
|
+
### Color
|
|
58
|
+
|
|
59
|
+
- **Color comes from components and surfaces**, or color tokens for a gap.
|
|
60
|
+
|
|
61
|
+
### Graphics and motion
|
|
62
|
+
|
|
63
|
+
- **SVG, canvas and WebGL:** no Set component serves them, so a need for them is always a gap.
|
|
64
|
+
- **Motion** comes from components, or motion tokens for a gap.
|
|
65
|
+
- **Images and video** use `Image` and `Video`. Raw elements only for a gap. A plain `img` is fine inside `Prose`.
|
|
66
|
+
|
|
67
|
+
### Components
|
|
68
|
+
|
|
69
|
+
- **Layout, structure, typographic and graphic components:** Set components first, custom only for a gap.
|
|
70
|
+
- **Control, navigation and status components:** Set components first, custom only for a gap.
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: compose-first
|
|
3
|
-
description: Use Set's components to build pages and sections, before authoring custom CSS. Read this when generating markup with @monospaced/set-core or @monospaced/set-react.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Compose first
|
|
7
|
-
|
|
8
|
-
Set is a compositional system. The fastest path to a correct, accessible, on-brand UI is to build out of the system's components and let their props express your intent — essentially no custom CSS, only tokens for minor edge-case tweaks. Anything beyond that belongs to the next layer.
|
|
9
|
-
|
|
10
|
-
## Root is required
|
|
11
|
-
|
|
12
|
-
Every Set app must be wrapped in `Root`. It emits the `.set` scoping class that every component's CSS targets, sets the brand and (optional) theme, and carries language / direction attributes. Without it, components render unstyled.
|
|
13
|
-
|
|
14
|
-
For a top-level app, set `appRoot`:
|
|
15
|
-
|
|
16
|
-
```tsx
|
|
17
|
-
<Root appRoot>{/* page composition here */}</Root>
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
For embedded use (e.g. injecting Set into a portion of a non-Set page), omit `appRoot`. `Root` still scopes its subtree.
|
|
21
|
-
|
|
22
|
-
## Surface (color context)
|
|
23
|
-
|
|
24
|
-
`Surface` sets a color context for nested content. Wrap a region in `Surface` to apply a different context — e.g. a brand-coloured strip inside an otherwise-default page:
|
|
25
|
-
|
|
26
|
-
```tsx
|
|
27
|
-
<Surface variant="brandSubtle">
|
|
28
|
-
{/* content renders against the subtle brand surface */}
|
|
29
|
-
</Surface>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
`Surface` can scope context across any region — a single strip, a section, or the whole page.
|
|
33
|
-
|
|
34
|
-
Several components (`Box`, `Card`, `Panel`, etc.) also accept a `surface` prop — switch context at the component level without a separate wrapper:
|
|
35
|
-
|
|
36
|
-
```tsx
|
|
37
|
-
<Box surface="brandSubtle" paddingBlock="xl">
|
|
38
|
-
{/* ... */}
|
|
39
|
-
</Box>
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Layout primitives
|
|
43
|
-
|
|
44
|
-
Reach for these first:
|
|
45
|
-
|
|
46
|
-
- `Page` — top-level shell with `banner`, `header`, `children` (main), `footer` slots.
|
|
47
|
-
- `Container` — wraps page-level content with a bounded inline width.
|
|
48
|
-
- `Grid` + `GridItem` — 12-column responsive layout. The primary chassis for main content beyond a single column.
|
|
49
|
-
- `Stack` — vertical group with consistent `gap` (token-driven flex wrapper).
|
|
50
|
-
- `Inline` — horizontal group with consistent `gap` (token-driven flex wrapper).
|
|
51
|
-
- `Box` — a low-level boundary and inset primitive with optional light containment.
|
|
52
|
-
|
|
53
|
-
The canonical main-content chain is `Root` → `Page` → `Container` → `Grid` → `GridItem` → `Stack` / `Inline`. `Box` is a low-level primitive with no fixed position — wrap any step where padding, background, or border is needed (commonly around `Grid` for section padding, around `Stack`/`Inline` inside a `GridItem`, or around individual children). Site furniture (headers, footers, navigation) typically nests more simply — `Container` → `Inline` / `Stack` — with `Box` where padding rhythm is needed.
|
|
54
|
-
|
|
55
|
-
`Stack` and `Inline` hold a single fixed arrangement — `Inline` wraps when it runs out of room, but neither _switches_ arrangement at a breakpoint (e.g. stacked when narrow, side-by-side when wide). Responsive layout change lives in `Grid` / `GridItem`, and that is page-level. A self-contained block that needs its own breakpoint-driven layout switch is a genuine gap — handle it in the custom-with-tokens layer (a local component with container- or media-query CSS), not by forcing `Stack` / `Inline`.
|
|
56
|
-
|
|
57
|
-
## Decision flow
|
|
58
|
-
|
|
59
|
-
When asked to build a page or section:
|
|
60
|
-
|
|
61
|
-
1. **Pages** → use `Page`. Assemble `header` / `children` / `footer` slots from compositions, not custom HTML. The optional `banner` slot expects a `Banner` component (site-wide dismissible announcement).
|
|
62
|
-
2. **Bounded content** → use `Container`. Don't author custom max-width wrappers.
|
|
63
|
-
3. **Main content layout** → use `Grid` + `GridItem`. The 12-column responsive system is the primary chassis for page bodies. `GridItem` is a wrapper around the CSS grid-item layout surface — column/row placement, spans, alignment — configured per-item via props (not via classes on the parent).
|
|
64
|
-
4. **Vertical groups** → use `Stack` with `gap`. Not margins.
|
|
65
|
-
5. **Horizontal groups** → use `Inline` with `gap`. Not flex.
|
|
66
|
-
6. **Insetting content or applying a boundary** → use `Box` (low-level primitive). For higher-level contained content (a styled container as a unit), reach for `Panel`.
|
|
67
|
-
7. **Structural patterns** → use the matching component (cards, navigation, posters, sidebars, etc.) rather than re-rolling. Check the References below for components you may not know about.
|
|
68
|
-
8. **Headings** → use `Heading`. `level` and `size` are deliberately decoupled — pick `level` for semantic hierarchy (no skipped levels), `size` for visual treatment.
|
|
69
|
-
9. **Inline copy or authored paragraphs** → use `Text`. Supports inline (`as: "span"`) and paragraph (`as: "p"`) form, and accepts inline markup (`<em>`, `<strong>`, `<a>`, `<code>`, etc.) as children for emphasis, links, and code.
|
|
70
|
-
10. **Rich text** (raw block markup, typically from markdown or CMS HTML) → use `Prose`. It styles `<h1>`–`<h6>`, `<p>`, lists, tables, etc. per the system's typography. For paragraphs you compose directly in your layout, use `Text` instead.
|
|
71
|
-
11. **Other leaves** (image, icon, link, button, divider, etc.) → use the matching content component instead of raw HTML. Check the References below for components you may not know about.
|
|
72
|
-
|
|
73
|
-
## Smell tests
|
|
74
|
-
|
|
75
|
-
Custom CSS at this layer is at most a one-off, token-based tweak (e.g. nudging a single property by a small amount). If you're about to write more than that, stop. One of two things is true:
|
|
76
|
-
|
|
77
|
-
- You missed a compositional path — re-read the decision flow above, and check the References for components you may not know about.
|
|
78
|
-
- The system doesn't cover this case, so you've left compose-first — move to the next layer (custom with tokens).
|
|
79
|
-
|
|
80
|
-
## When composition isn't enough
|
|
81
|
-
|
|
82
|
-
If a layout genuinely can't be expressed with the existing components, the next layer is custom markup with design tokens. That layer has its own guidance.
|
|
83
|
-
|
|
84
|
-
## References
|
|
85
|
-
|
|
86
|
-
- Component catalog (live): [Storybook](https://set.monospaced.com/storybook).
|
|
87
|
-
- Component SPECs: imported from `@monospaced/set-core` (e.g. `SET_STACK_SPEC`) — runtime values with top-level `description` and per-prop documentation. Confirms what each component does before you reach for raw HTML.
|
|
88
|
-
- Token catalog (CSS, browseable in your editor): `@monospaced/set-config/set.catalog.css`.
|
|
89
|
-
- Token data (JSON, for agents and tooling): `@monospaced/set-tokens/mnsp`, `@monospaced/set-tokens/base`.
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: custom-with-tokens
|
|
3
|
-
description: When the system has a gap — a missing component, variant, or pattern — fill it using Set's existing components for everything that fits, and tokens for any residual CSS values. Read this when compose-first has run out and you're about to author custom markup.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Custom with tokens
|
|
7
|
-
|
|
8
|
-
The fastest path through a gap is _with_ the system, not around it.
|
|
9
|
-
|
|
10
|
-
## When this applies
|
|
11
|
-
|
|
12
|
-
You've worked through the compose-first decision flow and one of two things is true:
|
|
13
|
-
|
|
14
|
-
- The system genuinely doesn't cover the case (e.g. a Stepper — see the worked example below).
|
|
15
|
-
- The case wants a visual treatment outside any existing component's prop surface.
|
|
16
|
-
- A self-contained block needs breakpoint-driven layout that no prop exposes — `Stack` / `Inline` hold one arrangement (`Inline` only wraps) and `Grid` / `GridItem` responsiveness is page-level, so component-local layout switching is a genuine gap.
|
|
17
|
-
|
|
18
|
-
If you haven't checked compose-first first, do that. Many "I need custom markup/CSS" intuitions evaporate once you find the right component.
|
|
19
|
-
|
|
20
|
-
## The layered model
|
|
21
|
-
|
|
22
|
-
When you fill a gap:
|
|
23
|
-
|
|
24
|
-
1. **Reuse existing components.** Inside your custom markup, reach for Set components wherever they apply — `Icon`, `Button`, `Heading`, `Text`, `Link`, `Divider`, `Image`, etc. Many leaves you'd reach for in plain HTML have a Set equivalent that handles a11y, sizing, and brand defaults for free. Check the References below for components you may not know about.
|
|
25
|
-
2. **Write custom markup + CSS** for the parts no component covers — the structure, the wiring, the bespoke piece.
|
|
26
|
-
3. **Reference tokens for design values.** Colors, spacing, dimensions, typography, motion, shadows, opacity, etc. — reach for `var(--set-*)` whenever the system has a token. Tokens resolve under theme (light / dark), brand, and surface context automatically; responsive variants (typography, layout spacing) carry breakpoint scale baked in. Raw values lose all of that. See the References below for the catalog.
|
|
27
|
-
|
|
28
|
-
The order matters. Tokens won't backfill what a component would have given you (a11y, sizing, brand defaults). Reach for the component first; only diverge when the design genuinely needs something outside its prop surface.
|
|
29
|
-
|
|
30
|
-
## Picking the right token
|
|
31
|
-
|
|
32
|
-
The published token catalog ships at `@monospaced/set-config/set.catalog.css` — a `:root` block listing every `--set-*` token with its resolved value and `$description`. The same data ships as DTCG JSON via `@monospaced/set-tokens/{mnsp,base}` if your tooling wants tokens as data.
|
|
33
|
-
|
|
34
|
-
Tokens are organised by category prefix (e.g. `--set-color-*`, `--set-spacing-*`, `--set-radius-*`). The category narrows the search; the `$description` on each token confirms semantic intent — read it before reaching for a token whose name sounds right.
|
|
35
|
-
|
|
36
|
-
If the right token feels missing for your case, that may signal a system gap worth surfacing as an issue rather than an opportunity to reach for a literal value.
|
|
37
|
-
|
|
38
|
-
## Accessibility
|
|
39
|
-
|
|
40
|
-
All UI built with Set must meet [WCAG 2.2 AA](https://www.w3.org/TR/WCAG22/) — the same bar the system holds itself to internally. A few points specific to Set worth highlighting:
|
|
41
|
-
|
|
42
|
-
- **Color contrast follows from tokens.** Set's color tokens are tuned to meet WCAG AA contrast minimums for their _intended pairings_. Each token's `$description` names its role — read it to verify the pairing fits. Arbitrary `--set-color-*` combinations don't automatically satisfy AA.
|
|
43
|
-
- **`.visually-hidden` for SR-only context.** Set ships a `.visually-hidden` utility class from `Root`. Use it for screen-reader-only text — accessible names for icon-only controls, state announcements (e.g. "step complete"), context that's redundant visually but needed for SR. Prefer a visible label, then `.visually-hidden`, then `aria-label` (last resort).
|
|
44
|
-
- **Don't remove or recolour the focus indicator.** Set's `Root` CSS provides a focus-visible indicator on every interactive element — don't remove it, and don't change its color. Adjusting offset / inset / radius to fit a custom shape is fine. Wire your custom logic to keyboard events the same way you wire it to clicks.
|
|
45
|
-
|
|
46
|
-
Refer to [Using ARIA](https://www.w3.org/TR/using-aria/) before adding ARIA attributes. When implementing ARIA patterns, the APG below is the canonical reference — with caveats.
|
|
47
|
-
|
|
48
|
-
### ARIA Authoring Practices Guide (APG) patterns
|
|
49
|
-
|
|
50
|
-
The [APG patterns](https://www.w3.org/WAI/ARIA/apg/patterns/) are a partially trusted source — use selectively.
|
|
51
|
-
|
|
52
|
-
**CAN reference:**
|
|
53
|
-
|
|
54
|
-
- Content in "About This Interaction" sections
|
|
55
|
-
- Content in "Keyboard Interaction" sections
|
|
56
|
-
|
|
57
|
-
**CANNOT reference:**
|
|
58
|
-
|
|
59
|
-
- Code examples from APG
|
|
60
|
-
- CodePen links (URLs starting with `https://codepen.io/`)
|
|
61
|
-
|
|
62
|
-
## CSS architecture
|
|
63
|
-
|
|
64
|
-
Match the system's CSS authoring pattern so your custom rules co-exist cleanly with system rules:
|
|
65
|
-
|
|
66
|
-
```css
|
|
67
|
-
:where(.set) .app-step-indicator {
|
|
68
|
-
/* base styles */
|
|
69
|
-
|
|
70
|
-
.step {
|
|
71
|
-
/* descendant styles */
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
- **`:where(.set)`** scopes selectors to a Set `Root`. Your custom components must render inside a Set `Root` (or any descendant of one) — the `Root` applies the system's foundational styles (typography, color context, brand) that your custom CSS inherits and composes against, and provides the `.set` ancestor the `:where(.set)` selector matches. `:where()` contributes zero specificity, so the root selector sits at `0,1,0` — matching how the system scopes its own rules. Nested descendant and state selectors follow normal CSS specificity from there. Combined with standard CSS source order (e.g. your custom CSS loaded after `@monospaced/set-core/styles.css`), conflicts resolve predictably in your favour.
|
|
77
|
-
- **Project-prefixed class names** (`.app-*`, `.my-*`, anything but `.set-*`) avoid collisions with system class names. Prefix the component-level class; nest descendants unprefixed (mirroring how the system authors its own components).
|
|
78
|
-
|
|
79
|
-
## Smell tests
|
|
80
|
-
|
|
81
|
-
You've gone past "filling a gap" and started building parallel infrastructure when:
|
|
82
|
-
|
|
83
|
-
- You're using raw values (e.g. `16px`, `#ffaa00`, `0.5s`) or wrong-category tokens (e.g. `padding: var(--set-color-foreground-default)`) for design values. Lint catches most foot-guns but has gaps. Every design value should resolve to a `var(--set-*)` whose name matches the property's intent.
|
|
84
|
-
- You're writing CSS that targets Set's `.set-*` component classes or any of their descendants. Don't override Set component internals from the consumer side — ever. Use the component's prop surface, switch surface context, or fill the gap with a custom `.app-*` component instead.
|
|
85
|
-
- Your tokens look like a parallel theming layer with `--set-` prefixes you defined yourself. Don't squat on the namespace; pick `--my-*` or your own app/project prefix for any project-specific custom properties.
|
|
86
|
-
- You're disabling lint rules to ship. The disable comment should carry rationale that survives review — if it'd surprise a future reader, the right move is usually a system change (a missing token, a refined component) rather than a permanent escape.
|
|
87
|
-
|
|
88
|
-
## Examples
|
|
89
|
-
|
|
90
|
-
The stepper example, `@monospaced/set-skills/custom-with-tokens/examples/stepper.md`, fills a gap with the system.
|
|
91
|
-
|
|
92
|
-
## References
|
|
93
|
-
|
|
94
|
-
- Token catalog (CSS, browseable in your editor): `@monospaced/set-config/set.catalog.css`.
|
|
95
|
-
- Token data (JSON, for agents and tooling): `@monospaced/set-tokens/mnsp`, `@monospaced/set-tokens/base`.
|
|
96
|
-
- Component catalog (live): [Storybook](https://set.monospaced.com/storybook).
|
|
97
|
-
- Component SPECs: imported from `@monospaced/set-core` (e.g. `SET_BUTTON_SPEC`) — runtime values with top-level `description` and per-prop documentation. Confirms what each component does before you reach for raw HTML.
|
|
File without changes
|