Skip to content

Commit 7e3bad3

Browse files
committed
docs: restore full version display in side nav and add new Component versioning guide page
1 parent 07345d0 commit 7e3bad3

5 files changed

Lines changed: 107 additions & 29 deletions

File tree

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
title: Component versioning
3+
category: Guides
4+
order: 5
5+
---
6+
7+
## Why components are versioned
8+
9+
When InstUI needs to make a breaking change to a component (renamed props, changed behaviour, etc.), the old version is **kept alongside the new one** instead of being replaced. Upgrading the library no longer forces you to immediately rewrite every component usage — you can migrate to new versions on your own schedule.
10+
11+
New component versions appear with InstUI **minor** version bumps (e.g. `11.7``11.8`). Patch releases never include breaking changes.
12+
13+
## Import paths
14+
15+
Every InstUI component package supports three import styles:
16+
17+
### Default — `@instructure/ui-<name>`
18+
19+
Always points to the **oldest** still-supported component version. Upgrading the library without changing your imports will keep your code working without surprises.
20+
21+
```js
22+
---
23+
type: code
24+
---
25+
import { Alert } from '@instructure/ui-alerts'
26+
```
27+
28+
### Pinned — `@instructure/ui-<name>/v11_X`
29+
30+
Locks the import to a specific InstUI minor version of the component. When you are ready to adopt a breaking change, update the path to the next pinned version.
31+
32+
```js
33+
---
34+
type: code
35+
---
36+
import { Alert } from '@instructure/ui-alerts/v11_7'
37+
```
38+
39+
### Latest — `@instructure/ui-<name>/latest`
40+
41+
Always points to the newest component version. This may bring breaking changes when you upgrade InstUI itself.
42+
43+
```js
44+
---
45+
type: code
46+
---
47+
import { Alert } from '@instructure/ui-alerts/latest'
48+
```
49+
50+
### Per-package or umbrella package
51+
52+
InstUI also ships an umbrella package, `@instructure/ui`, which re-exports every component from the individual `@instructure/ui-*` packages. Two equivalent import styles work — both resolve to the same component:
53+
54+
```js
55+
---
56+
type: code
57+
---
58+
// per-package import
59+
import { Alert } from '@instructure/ui-alerts/v11_7'
60+
61+
// umbrella package import
62+
import { Alert } from '@instructure/ui/v11_7'
63+
```
64+
65+
The same three path styles (default / `/v11_X` / `/latest`) work on the umbrella package as well. Pick per-package imports when you want better tree-shaking and only pull in what you use, or the umbrella package when you'd rather depend on a single `@instructure/ui` entry in your `package.json`.
66+
67+
## Versions and theming engines
68+
69+
InstUI is in the middle of a transition between two theming systems. Which engine a component uses depends on which version you import:
70+
71+
- **`v11_6` and earlier** — legacy theming. Components are configured through the Canvas theme variables and the `themeOverride` prop, which accepts a function or object that maps to the component's own theme map. See the [Legacy theme overrides](legacy-theme-overrides) guide.
72+
73+
- **`v11_7` and newer** — new theming system. Components consume pre-resolved design tokens, and theming is done through the new token override structure. See the [New theme overrides](new-theme-overrides) guide.
74+
75+
Mixing imports from both groups in the same app is fully supported — the two engines run side-by-side without conflict.
76+
77+
### Supported themes per version
78+
79+
Each version of the library is only compatible with the themes built for its theming engine:
80+
81+
- **`v11_6` and earlier** support the legacy themes:
82+
83+
- `canvas`
84+
- `canvasHighContrast`
85+
86+
- **`v11_7` and newer** support themes built on the new token system. The legacy Canvas looks are preserved (re-implemented on the new engine) and two brand-new themes are added:
87+
88+
- `legacyCanvas` — same visual style as the old `canvas`, but on the new engine
89+
- `legacyCanvasHighContrast` — same visual style as the old `canvasHighContrast`, on the new engine
90+
- `light` — new light theme
91+
- `dark` — new dark theme
92+
93+
This means that when you move a component import from `/v11_6` to `/v11_7` you don't have to change anything visually — you can stay on the `legacyCanvas` theme and opt in to `light` or `dark` only when you're ready.

docs/theming/legacy-theme-overrides.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@ relevantForAI: true
77

88
## Using theme overrides
99

10-
```js
11-
---
12-
type: embed
13-
---
14-
<Alert variant="warning" margin="0 0 medium">
15-
The examples on this page use the <strong>legacy theming system</strong> and are designed for <strong>v11.6</strong> components. If you are viewing the v11.7 version, <Link href={window.location.pathname.match(/v\d+_\d+/) ? window.location.pathname.replace(/v\d+_\d+/, 'v11_6') : `/v11_6${window.location.pathname}`}>switch to v11.6</Link> to see the examples working correctly.
16-
</Alert>
17-
```
18-
1910
This document gives an overview on how you can customize Instructure UI components by tweaking their theme variables.
2011
While this gives you a level of flexibility on the look and feel of the components you should be aware of 2 things:
2112

docs/theming/new-theme-overrides.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@ relevantForAI: true
77

88
## New Theme Override Patterns
99

10-
```js
11-
---
12-
type: embed
13-
---
14-
<Alert variant="warning" margin="0 0 medium">
15-
The examples on this page use the <strong>new theming system</strong> and require <strong>v11.7+</strong> components. If you are viewing the v11.6 version, <Link href={window.location.pathname.match(/v\d+_\d+/) ? window.location.pathname.replace(/v\d+_\d+/, 'v11_7') : `/v11_7${window.location.pathname}`}>switch to v11.7</Link> to see the examples working correctly.
16-
</Alert>
17-
```
18-
1910
This guide covers all the override patterns available in the new theming system (v11.7+). The new system uses a layered token architecture: **primitives** (raw values) -> **semantics** (meaning) -> **components** (per-component tokens).
2011

2112
Overrides are applied via the `themeOverride` prop on `InstUISettingsProvider`, which is separate from the `theme` prop. The `theme` prop replaces the active theme entirely; `themeOverride` layers modifications on top.

packages/__docs__/src/App/index.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ class App extends Component<AppProps, AppState> {
625625

626626
const formatMinorVersion = (version: string) => {
627627
const formatted = version.replace(/_/g, '.')
628-
if (version === 'v11_7') return `${formatted}`
628+
if (version === 'v11_6') return `${formatted} (legacy theming)`
629629
return formatted
630630
}
631631

@@ -635,10 +635,15 @@ class App extends Component<AppProps, AppState> {
635635
? this.state.themeKey
636636
: themeKeys[0]
637637

638-
const { key } = this.state
638+
const { key, docsData } = this.state
639639
const versionLockedPages = ['legacy-theme-overrides', 'new-theme-overrides']
640640
if (versionLockedPages.includes(key ?? '')) return null
641641

642+
// Only show on Components pages — other categories (guides, utilities,
643+
// themes, etc.) don't need theme or component-version switching.
644+
const category = key ? docsData?.docs[key]?.category : undefined
645+
if (!category || !category.startsWith('components')) return null
646+
642647
const showMinorVersionSelect =
643648
minorVersionsData && minorVersionsData.libraryVersions.length > 1
644649

@@ -825,8 +830,9 @@ class App extends Component<AppProps, AppState> {
825830
{this.renderThemeSelect()}
826831
{isGuidePage && (
827832
<Alert variant="info" margin="xx-large 0">
828-
This page always displays the latest version of the documentation.{' '}
829-
<Link href="multi-version-system">
833+
This page is made for the latest version (
834+
{this.getLatestMinorVersion()?.replace('_', '.')}) of InstUI.{' '}
835+
<Link href="component-versioning">
830836
Learn more about the versioning system
831837
</Link>
832838
</Alert>

packages/__docs__/src/Header/index.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,12 @@ class Header extends Component<HeaderProps> {
8484
}
8585

8686
/**
87-
* Returns the version string for display: major only (e.g. "v10") when
88-
* minor version switcher is active, full semver otherwise.
87+
* Returns the full semver string for display (e.g. "11.7.0").
88+
* Minor-version switching is handled in the Component version Select
89+
* on Components pages, so we always show the precise library version here.
8990
*/
9091
getDisplayVersion = () => {
91-
const { version, minorVersionsData } = this.props
92-
if (minorVersionsData && version) {
93-
return version.split('.')[0]
94-
}
95-
return version
92+
return this.props.version
9693
}
9794

9895
renderVersionsBlock = () => {

0 commit comments

Comments
 (0)