Skip to content

Commit 219d113

Browse files
committed
docs: add new theming system section and finalize upgrade guide
1 parent ced0fb5 commit 219d113

1 file changed

Lines changed: 61 additions & 1 deletion

File tree

docs/upgrading/upgrade-guide.md

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,67 @@ order: 2
88

99
## New theming system
1010

11-
NOTE: this section is under development, will be updated soon
11+
InstUI v11.7 introduces a new theming engine. Components imported from `/v11_7` (the `v2` label in the docs "Component version" selector) consume design tokens directly from the active theme. Components imported from `/v11_6` (the `v1` label) continue to use the legacy `generateComponentTheme` approach. **Both engines run side-by-side in the same app without conflict** — you can migrate component-by-component on your own schedule.
12+
13+
### What's different
14+
15+
- **Layered token model.** Tokens are organized as **primitives** (raw values like colors and spacings) → **semantics** (contextual mappings like `color.text.base`) → **components** (per-component tokens). Cross-component concerns such as focus rings and box shadows live in `sharedTokens`. Most overrides happen at the component layer.
16+
- **No per-component `theme.ts`.** v2 components don't define a `generateComponentTheme` function, their tokens are emitted by the active theme rather than computed by the component itself.
17+
18+
### New themes
19+
20+
The new engine ships four themes:
21+
22+
- **`legacyCanvas`** — visually identical to the old `canvas`, on the new engine. Recommended for apps migrating without a visual redesign.
23+
- **`legacyCanvasHighContrast`** — visual parity with old `canvasHighContrast`.
24+
- **`light`** — new light theme.
25+
- **`dark`** — new dark theme.
26+
27+
The legacy `canvas` and `canvasHighContrast` themes still exist and remain the correct choice for v1 components.
28+
29+
### Override mechanism
30+
31+
The two entry points are the same as in the legacy system:
32+
33+
- **Provider-scoped**`themeOverride` prop on `InstUISettingsProvider`, applied to its subtree.
34+
- **Per-component**`themeOverride` prop directly on a single component instance. Has the highest priority and overrides any provider-level setting for that instance.
35+
36+
What changed:
37+
- **Theme overrides**: in v11.7 `InstUISettingsProvider`'s theme prop only accepts a full theme object. For v11.7 or later use the new `themeOverride` prop
38+
- **Token names/values**: Lots of components had their theme tokens changed -- removed, added or renamed. Check the rest of this guide for the full list of changes.
39+
40+
`themeOverride` remains separate from the `theme` prop — `theme` swaps the active theme entirely, `themeOverride` layers changes on top. See [New theme overrides](new-theme-overrides) for subtree-scoped overrides, primitives / semantics overrides, shared tokens, and priority rules.
41+
42+
### Migrating an app
43+
44+
Because the legacy and new engines run side-by-side, **you don't have to migrate everything at once**. Reasonable strategies:
45+
46+
- A few components first (e.g. `Alert` and `Button`), leaving the rest on `/v11_6`.
47+
- A whole route or feature subtree at a time, scoped via a local `InstUISettingsProvider` with the new theme.
48+
- The whole app in a single sweep.
49+
50+
The recommended path uses the **`updateInstUIImportVersions` codemod**
51+
52+
1. **Inspect first.** Run the codemod in **diagnose mode** (`--diagnose=true`) to list every versioned `@instructure/*` import in your codebase and the version each is pinned to. No files are modified.
53+
54+
2. **Bump import paths.** Same codemod, now in update mode:
55+
56+
- All versioned components at once: `--versionTo=v11.7`.
57+
- Only specific components: `--versionTo=v11.7 --components=Button,Alert` (useful for incremental migration).
58+
- Only imports already at a specific version: `--versionFrom=v11.6 --versionTo=v11.7`.
59+
60+
Imports that mix versioned components with other symbols are split into two declarations automatically. Utilities and non-versioned exports are left untouched.
61+
62+
Learn more in the **Codemod** section ([full command reference below](upgrade-guide#Codemods))
63+
64+
3. **Switch the theme.** Replace `canvas` with `legacyCanvas` wherever the bumped components live — visuals stay identical and the new override surface becomes available. Use `light` or `dark` for a redesign. The `theme` prop on `InstUISettingsProvider` can scope this to a subtree.
65+
66+
4. **Update per-component theme overrides.** Many v2 components have renamed / added / removed tokens — see the component-specific sections below for the exact changes.
67+
68+
### Further reading
69+
70+
- **[Component versioning](component-versioning)** — how the two engines coexist, import paths, and which themes work with which version.
71+
- **[New theme overrides](new-theme-overrides)** — full guide to the new override structure with worked examples.
1272

1373
## New icons
1474

0 commit comments

Comments
 (0)