@monospaced/set-skills 0.24.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.
@@ -0,0 +1,203 @@
1
+ <!-- Generated by scripts/sync.mjs from templates/stepper.md and apps/playground/src/stepper. Do not edit. -->
2
+
3
+ # Stepper
4
+
5
+ A stepper shows where someone is in a multi-step process: onboarding, checkout, a long form split across pages. It's a row of numbered steps, each done, current or upcoming, joined by a line. Set doesn't ship one, so it's a gap to fill with the system: a Set component where one fits, custom markup for the rest, and tokens for every design value.
6
+
7
+ ```tsx
8
+ import "./Stepper.css";
9
+
10
+ import { Icon } from "@monospaced/set-react";
11
+
12
+ type Step = { label: string; number: number };
13
+ type StepState = "current" | "done" | "upcoming";
14
+
15
+ export const steps: Step[] = [
16
+ { number: 1, label: "Plan" },
17
+ { number: 2, label: "Build" },
18
+ { number: 3, label: "Ship" },
19
+ ];
20
+
21
+ function getStepState(index: number, currentStep: number): StepState {
22
+ if (currentStep >= steps.length) return "done";
23
+ if (index < currentStep) return "done";
24
+ if (index === currentStep) return "current";
25
+ return "upcoming";
26
+ }
27
+
28
+ export function Stepper({ currentStep }: { currentStep: number }) {
29
+ return (
30
+ <ol className="app-stepper">
31
+ {steps.map(({ number, label }, index) => {
32
+ const state = getStepState(index, currentStep);
33
+
34
+ return (
35
+ <li
36
+ key={number}
37
+ className="step"
38
+ data-state={state}
39
+ {...(state === "current" ? { "aria-current": "step" } : {})}
40
+ >
41
+ <span className="bubble" aria-hidden="true">
42
+ <span className="bubble-number">{number}</span>
43
+ <span className="bubble-icon">
44
+ <Icon name="check" size="xs" />
45
+ </span>
46
+ </span>
47
+ <span className="label">
48
+ {label}
49
+ {state === "done" ? (
50
+ <span className="visually-hidden">, completed</span>
51
+ ) : null}
52
+ {state === "current" ? (
53
+ <span className="visually-hidden">, current step</span>
54
+ ) : null}
55
+ </span>
56
+ </li>
57
+ );
58
+ })}
59
+ </ol>
60
+ );
61
+ }
62
+ ```
63
+
64
+ ```css
65
+ :where(.set) .app-stepper {
66
+ --app-stepper-size: var(--set-spacing-vertical-800);
67
+
68
+ display: flex;
69
+ list-style: none;
70
+ margin: 0;
71
+ padding-inline: 0;
72
+
73
+ .bubble {
74
+ background-color: var(--set-color-background-subtle);
75
+ block-size: var(--app-stepper-size);
76
+ border-radius: calc(var(--app-stepper-size) * var(--set-radius-ratio-lg));
77
+ color: var(--set-color-foreground-muted-text);
78
+ display: grid;
79
+ font: var(--set-typography-text-body-xs-font);
80
+ font-variant-numeric: tabular-nums;
81
+ font-variation-settings: var(
82
+ --set-typography-font-variation-settings-default
83
+ );
84
+ font-weight: var(--set-typography-font-weight-bold);
85
+ inline-size: var(--app-stepper-size);
86
+ place-items: center;
87
+ position: relative;
88
+ transition:
89
+ background-color var(--set-motion-duration-200)
90
+ var(--set-motion-easing-ease-in-out),
91
+ color var(--set-motion-duration-200) var(--set-motion-easing-ease-in-out);
92
+ }
93
+
94
+ .bubble-icon,
95
+ .bubble-number {
96
+ grid-area: 1 / 1;
97
+ }
98
+
99
+ .bubble-icon {
100
+ opacity: 0;
101
+ scale: 0.7;
102
+ transition:
103
+ opacity var(--set-motion-duration-200) var(--set-motion-easing-ease-out),
104
+ scale var(--set-motion-duration-200) var(--set-motion-easing-ease-out);
105
+
106
+ @media (prefers-reduced-motion: reduce) {
107
+ scale: 1;
108
+ transition: opacity var(--set-motion-duration-200)
109
+ var(--set-motion-easing-ease-out);
110
+ }
111
+ }
112
+
113
+ .label {
114
+ color: var(--set-color-foreground-muted-text);
115
+ font: var(--set-typography-text-body-xs-font);
116
+ font-variation-settings: var(
117
+ --set-typography-font-variation-settings-default
118
+ );
119
+ font-weight: var(--set-typography-font-weight-medium);
120
+ inline-size: max-content;
121
+ }
122
+
123
+ .step {
124
+ display: grid;
125
+ flex: 1;
126
+ gap: var(--set-spacing-vertical-400);
127
+ grid-template-columns: var(--app-stepper-size);
128
+ isolation: isolate;
129
+ justify-content: center;
130
+ justify-items: center;
131
+ position: relative;
132
+
133
+ &::after {
134
+ background-color: var(--set-color-border-subtle);
135
+ block-size: var(--set-layout-border-width-thick);
136
+ content: "";
137
+ inline-size: 100%;
138
+ inset-block-start: calc(
139
+ (var(--app-stepper-size) / 2) -
140
+ (var(--set-layout-border-width-thick) / 2)
141
+ );
142
+ inset-inline-start: 50%;
143
+ position: absolute;
144
+ z-index: -1;
145
+ }
146
+
147
+ &:first-child {
148
+ justify-content: start;
149
+ }
150
+
151
+ &:first-child::after {
152
+ inline-size: calc(150% - (var(--app-stepper-size) / 2));
153
+ inset-inline-start: calc(var(--app-stepper-size) / 2);
154
+ }
155
+
156
+ &:nth-last-child(2)::after {
157
+ inline-size: calc(150% - (var(--app-stepper-size) / 2));
158
+ }
159
+
160
+ &:last-child {
161
+ justify-content: end;
162
+ }
163
+
164
+ &:last-child::after {
165
+ display: none;
166
+ }
167
+
168
+ &[data-state="done"]::after {
169
+ background-color: var(--set-color-foreground-default);
170
+ }
171
+ }
172
+
173
+ .step[data-state="current"] .bubble,
174
+ .step[data-state="done"] .bubble {
175
+ background-color: var(--set-color-foreground-default);
176
+ color: var(--set-color-foreground-contrast);
177
+ }
178
+
179
+ .step[data-state="done"] .bubble-icon {
180
+ opacity: 1;
181
+ scale: 1;
182
+ }
183
+
184
+ .step[data-state="done"] .bubble-number {
185
+ opacity: 0;
186
+ }
187
+
188
+ .step[data-state="current"] .label,
189
+ .step[data-state="done"] .label {
190
+ color: var(--set-color-foreground-default);
191
+ }
192
+ }
193
+ ```
194
+
195
+ ## Notes
196
+
197
+ - **`Icon` is the one leaf a component covers.** It handles the checkmark's sizing and color inheritance. The number and the icon both render on every step, and CSS reveals the one the state calls for.
198
+ - **Why not `Text` for the number and label?** The design needs specific weights and tabular figures, and `Text` doesn't expose `font-weight` or `font-variant-numeric`. So the example drops to a plain `span`, takes the body-xs composite font token, and overrides only the deviations.
199
+ - **`data-state` is the seam between markup and styling.** State semantics live on the element, and each visual state is a CSS rule keyed off the attribute. An `error` state would be one more value in the data and one more CSS block, colored with `--set-color-intent-danger-*`.
200
+ - **One size, from one token.** `--app-stepper-size` is set once from a vertical spacing token, so the bubble follows the vertical rhythm and both sides match. It's round by convention, as step markers are, with a radius of `--set-radius-ratio-lg` times its size. The property is defined and consumed in the same file, which keeps it local to the component and satisfies the `set/set-known-tokens` lint rule.
201
+ - **The step is a one-column grid as wide as the bubble.** Centring the label in that column places it under the bubble whether the step is justified to the start, the centre or the end, in either writing direction, so the first and last labels need no offset of their own. A label wider than the bubble overhangs the row's ends by half the difference, so keep end labels short or give the row room.
202
+ - **Transitions, not keyframes.** A transition doesn't run on first render, so completed steps don't animate in as the page loads; the checkmark only moves when a step becomes done. Under `prefers-reduced-motion: reduce` the scale is dropped and the fade stands in.
203
+ - **Accessibility.** `aria-current="step"` marks the active step. The bubble is `aria-hidden` because the state is already carried by `aria-current` and by the `.visually-hidden` text appended to each label. `.visually-hidden` ships from `Root`, so there's nothing to redefine.
@@ -1,100 +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
- Inline code in this skill is shown in JSX for compactness. See `@monospaced/set-skills/compose-first/examples/core/` for template-string equivalents and `@monospaced/set-skills/compose-first/examples/react/` for the parallel JSX.
11
-
12
- ## Root is required
13
-
14
- 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.
15
-
16
- For a top-level app, set `appRoot`:
17
-
18
- ```tsx
19
- <Root appRoot>{/* page composition here */}</Root>
20
- ```
21
-
22
- For embedded use (e.g. injecting Set into a portion of a non-Set page), omit `appRoot`. `Root` still scopes its subtree.
23
-
24
- ## Surface (color context)
25
-
26
- `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:
27
-
28
- ```tsx
29
- <Surface variant="brandSubtle">
30
- {/* content renders against the subtle brand surface */}
31
- </Surface>
32
- ```
33
-
34
- `Surface` can scope context across any region — a single strip, a section, or the whole page.
35
-
36
- Several components (`Box`, `Card`, `Panel`, etc.) also accept a `surface` prop — switch context at the component level without a separate wrapper:
37
-
38
- ```tsx
39
- <Box surface="brandSubtle" paddingBlock="xl">
40
- {/* ... */}
41
- </Box>
42
- ```
43
-
44
- ## Layout primitives
45
-
46
- Reach for these first:
47
-
48
- - `Page` — top-level shell with `banner`, `header`, `children` (main), `footer` slots.
49
- - `Container` — wraps page-level content with a bounded inline width.
50
- - `Grid` + `GridItem` — 12-column responsive layout. The primary chassis for main content beyond a single column.
51
- - `Stack` — vertical group with consistent `gap` (token-driven flex wrapper).
52
- - `Inline` — horizontal group with consistent `gap` (token-driven flex wrapper).
53
- - `Box` — a low-level boundary and inset primitive with optional light containment.
54
-
55
- 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.
56
-
57
- `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`.
58
-
59
- ## Decision flow
60
-
61
- When asked to build a page or section:
62
-
63
- 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).
64
- 2. **Bounded content** → use `Container`. Don't author custom max-width wrappers.
65
- 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).
66
- 4. **Vertical groups** → use `Stack` with `gap`. Not margins.
67
- 5. **Horizontal groups** → use `Inline` with `gap`. Not flex.
68
- 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`.
69
- 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.
70
- 8. **Headings** → use `Heading`. `level` and `size` are deliberately decoupled — pick `level` for semantic hierarchy (no skipped levels), `size` for visual treatment.
71
- 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.
72
- 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.
73
- 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.
74
-
75
- ## Smell tests
76
-
77
- 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:
78
-
79
- - You missed a compositional path — re-read the decision flow above, and check the References for components you may not know about.
80
- - The system doesn't cover this case, so you've left compose-first — move to the next layer (custom with tokens).
81
-
82
- ## When composition isn't enough
83
-
84
- 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.
85
-
86
- ## Examples
87
-
88
- Worked examples live alongside this skill:
89
-
90
- - `@monospaced/set-skills/compose-first/examples/core/` — for `@monospaced/set-core` consumers (SSR / web components / template strings).
91
- - `@monospaced/set-skills/compose-first/examples/react/` — for `@monospaced/set-react` consumers.
92
-
93
- Pick the flavor matching your project.
94
-
95
- ## References
96
-
97
- - Component catalog (live): [Storybook](https://set.monospaced.com/storybook).
98
- - 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.
99
- - Token catalog (CSS, browseable in your editor): `@monospaced/set-config/set.catalog.css`.
100
- - Token data (JSON, for agents and tooling): `@monospaced/set-tokens/mnsp`, `@monospaced/set-tokens/base`.
@@ -1,130 +0,0 @@
1
- # Full page (core)
2
-
3
- A complete page composition: branded header with nav, a content intro section laid on the 12-column responsive grid, footer. Built entirely from Set components — no custom CSS.
4
-
5
- ```ts
6
- import {
7
- defineSetNav,
8
- renderSetBox,
9
- renderSetButton,
10
- renderSetContainer,
11
- renderSetDivider,
12
- renderSetGrid,
13
- renderSetGridItem,
14
- renderSetHeading,
15
- renderSetInline,
16
- renderSetLogo,
17
- renderSetNav,
18
- renderSetPage,
19
- renderSetRoot,
20
- renderSetStack,
21
- renderSetText,
22
- } from "@monospaced/set-core";
23
-
24
- defineSetNav();
25
-
26
- const page = renderSetPage({
27
- headerBorder: "scroll",
28
- headerSize: "lg",
29
- stickyHeader: "always",
30
- header: renderSetContainer({
31
- gutter: "narrow",
32
- maxInlineSize: "wide",
33
- children: renderSetBox({
34
- paddingBlock: "sm",
35
- paddingInline: "none",
36
- responsive: true,
37
- children: renderSetInline({
38
- gap: "sm",
39
- justify: "between",
40
- children: [
41
- `<a href="/">${renderSetLogo({ label: "Brand", variant: "primary" })}</a>`,
42
- renderSetNav({
43
- collapsible: "belowTablet",
44
- contentId: "site-nav",
45
- expanderPosition: "end",
46
- items: [
47
- { current: "page", href: "/", label: "Home" },
48
- { href: "/work", label: "Work" },
49
- { href: "/about", label: "About" },
50
- ],
51
- }),
52
- ].join(""),
53
- }),
54
- }),
55
- }),
56
- children: renderSetContainer({
57
- children: renderSetBox({
58
- paddingBlock: "2xl",
59
- paddingInline: "none",
60
- children: renderSetGrid({
61
- children: renderSetGridItem({
62
- colSpan: 6,
63
- colSpanNarrow: 12,
64
- children: renderSetStack({
65
- align: "start",
66
- gap: "lg",
67
- children: [
68
- renderSetHeading({
69
- level: 1,
70
- responsive: true,
71
- size: "4xl",
72
- children: "A heading that anchors the section",
73
- }),
74
- renderSetText({
75
- as: "p",
76
- children:
77
- "Supporting copy that introduces the topic. Set's Text component handles the type scale and measure so this paragraph reads well at any viewport.",
78
- }),
79
- renderSetButton({
80
- appearance: "solid",
81
- label: "Get started",
82
- size: "lg",
83
- }),
84
- ].join(""),
85
- }),
86
- }),
87
- }),
88
- }),
89
- }),
90
- footer: renderSetContainer({
91
- gutter: "narrow",
92
- maxInlineSize: "wide",
93
- children: [
94
- renderSetDivider({ tone: "brand" }),
95
- renderSetBox({
96
- paddingBlock: "sm",
97
- paddingInline: "none",
98
- responsive: true,
99
- children: renderSetText({
100
- as: "p",
101
- tone: "muted",
102
- children: "© 2026 Brand",
103
- }),
104
- }),
105
- ].join(""),
106
- }),
107
- });
108
-
109
- const html = renderSetRoot({
110
- appOverscrollBehavior: "none",
111
- appRoot: true,
112
- children: page,
113
- });
114
- ```
115
-
116
- ## What's compositional here
117
-
118
- - **Root** wraps the app, emitting the `.set` scoping class every component's CSS targets. `appRoot` marks this as the owning app root.
119
- - **Page** owns the shell layout. Header is sticky.
120
- - **Container** bounds the header, main, and footer. The header / footer use a wider `gutter` and `maxInlineSize`; main keeps the default reading width.
121
- - **Box** carries vertical padding rhythm — `sm` for header, `2xl` for main, `md` for footer.
122
- - **Inline** lays out the logo and nav with `justify: "between"`.
123
- - **Nav** is a structural component that handles collapse / expander wiring at narrow viewports.
124
- - **Grid** + **GridItem** lay the main content on the 12-column responsive system. The item spans 6 columns at the default container threshold and falls back to all 12 at narrow viewports — the breakpoint behavior is built into the primitive.
125
- - **Stack** stacks the heading, copy, and CTA inside the grid item with a consistent `gap`. No margins.
126
- - **Heading**, **Text**, **Button**, **Logo**, **Divider** are content leaves.
127
-
128
- Main content runs the canonical chassis — **Root → Page → Container → Grid → GridItem → Stack → leaves** — with **Box** providing the section padding around the Grid (Box is a flexible primitive, applied wherever padding / background / border is needed; it has no fixed position in the chain). Site furniture (header, footer) rarely needs the column system, so it nests more simply: **Container → Inline → leaves**, again with Box where padding rhythm is needed.
129
-
130
- No custom CSS.
@@ -1,101 +0,0 @@
1
- # Full page (react)
2
-
3
- A complete page composition: branded header with nav, a content intro section laid on the 12-column responsive grid, footer. Built entirely from Set components — no custom CSS.
4
-
5
- ```tsx
6
- import {
7
- Box,
8
- Button,
9
- Container,
10
- Divider,
11
- Grid,
12
- GridItem,
13
- Heading,
14
- Inline,
15
- Logo,
16
- Nav,
17
- Page,
18
- Root,
19
- Stack,
20
- Text,
21
- } from "@monospaced/set-react";
22
-
23
- export function App() {
24
- return (
25
- <Root appOverscrollBehavior="none" appRoot>
26
- <Page
27
- headerBorder="scroll"
28
- headerSize="lg"
29
- stickyHeader="always"
30
- header={
31
- <Container gutter="narrow" maxInlineSize="wide">
32
- <Box paddingBlock="sm" paddingInline="none" responsive>
33
- <Inline gap="sm" justify="between">
34
- <a href="/">
35
- <Logo label="Brand" variant="primary" />
36
- </a>
37
- <Nav
38
- collapsible="belowTablet"
39
- contentId="site-nav"
40
- expanderPosition="end"
41
- items={[
42
- { current: "page", href: "/", label: "Home" },
43
- { href: "/work", label: "Work" },
44
- { href: "/about", label: "About" },
45
- ]}
46
- />
47
- </Inline>
48
- </Box>
49
- </Container>
50
- }
51
- footer={
52
- <Container gutter="narrow" maxInlineSize="wide">
53
- <Divider tone="brand" />
54
- <Box paddingBlock="sm" paddingInline="none" responsive>
55
- <Text as="p" tone="muted">
56
- © 2026 Brand
57
- </Text>
58
- </Box>
59
- </Container>
60
- }
61
- >
62
- <Container>
63
- <Box paddingBlock="2xl" paddingInline="none">
64
- <Grid>
65
- <GridItem colSpan={6} colSpanNarrow={12}>
66
- <Stack align="start" gap="lg">
67
- <Heading level={1} responsive size="4xl">
68
- A heading that anchors the section
69
- </Heading>
70
- <Text as="p">
71
- Supporting copy that introduces the topic. Set's Text
72
- component handles the type scale and measure so this
73
- paragraph reads well at any viewport.
74
- </Text>
75
- <Button appearance="solid" label="Get started" size="lg" />
76
- </Stack>
77
- </GridItem>
78
- </Grid>
79
- </Box>
80
- </Container>
81
- </Page>
82
- </Root>
83
- );
84
- }
85
- ```
86
-
87
- ## What's compositional here
88
-
89
- - **Root** wraps the app, emitting the `.set` scoping class every component's CSS targets. `appRoot` marks this as the owning app root.
90
- - **Page** owns the shell layout. Header is sticky.
91
- - **Container** bounds the header, main, and footer. The header / footer use a wider `gutter` and `maxInlineSize`; main keeps the default reading width.
92
- - **Box** carries vertical padding rhythm — `sm` for header, `2xl` for main, `md` for footer.
93
- - **Inline** lays out the logo and nav with `justify="between"`.
94
- - **Nav** is a structural component that handles collapse / expander wiring at narrow viewports.
95
- - **Grid** + **GridItem** lay the main content on the 12-column responsive system. The item spans 6 columns at the default container threshold and falls back to all 12 at narrow viewports — the breakpoint behavior is built into the primitive.
96
- - **Stack** stacks the heading, copy, and CTA inside the grid item with a consistent `gap`. No margins.
97
- - **Heading**, **Text**, **Button**, **Logo**, **Divider** are content leaves.
98
-
99
- Main content runs the canonical chassis — **Root → Page → Container → Grid → GridItem → Stack → leaves** — with **Box** providing the section padding around the Grid (Box is a flexible primitive, applied wherever padding / background / border is needed; it has no fixed position in the chain). Site furniture (header, footer) rarely needs the column system, so it nests more simply: **Container → Inline → leaves**, again with Box where padding rhythm is needed.
100
-
101
- No custom CSS.
@@ -1,102 +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
- Worked examples live alongside this skill:
91
-
92
- - `@monospaced/set-skills/custom-with-tokens/examples/core/` — for `@monospaced/set-core` consumers (SSR / web components / template strings).
93
- - `@monospaced/set-skills/custom-with-tokens/examples/react/` — for `@monospaced/set-react` consumers.
94
-
95
- Pick the flavor matching your project.
96
-
97
- ## References
98
-
99
- - Token catalog (CSS, browseable in your editor): `@monospaced/set-config/set.catalog.css`.
100
- - Token data (JSON, for agents and tooling): `@monospaced/set-tokens/mnsp`, `@monospaced/set-tokens/base`.
101
- - Component catalog (live): [Storybook](https://set.monospaced.com/storybook).
102
- - 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.