You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix React icon rendering in published consumers (#203)
* fix(react-components): inline bundled icons for consumers
Switch the default icon path away from bundled data URL <use> references so published consumers render icons reliably. Remove the public React spritePath API while keeping toolkit-backed icon rendering bundled by default.
* test(example-react-consumer-app): expand consumer smoke coverage
Update the packaged consumer app to exercise direct icons, Select, Card metadata icons, and checkbox ticks against the published tarball install contract.
* docs: prep react-components 0.8.0 icon release
Bump the React package version, add migration notes for the spritePath removal, and clarify the toolkit hosted-sprite contract versus the React bundled-icon contract.
* fix(react-components): satisfy icon lint cleanup
Replace the temporary destructuring-based spritePath strip with delete-on-copy so the legacy prop cleanup still works without triggering the repo's unused-vars rule.
* fix(icon): address follow-up PR feedback
Align the example consumer app colours to design-system token values, add unknown-icon coverage, and make bundled sprite parsing less format-sensitive.
- React `Icon` and `Card` icon configuration no longer accept `spritePath`. React icons now always render from bundled toolkit SVG data.
16
+
17
+
##### Fixed
18
+
19
+
- React icons now render correctly in published-consumer installs by inlining the requested bundled SVG symbol instead of referencing a bundled `data:` sprite URL.
|[v4.9.0 / React v0.7.0](#upgrading-to-v490--react-v070)| April 2026 | Icon naming sync | 🟡 Medium - Search/replace icon names |
12
-
|[v4.8.0 / React v0.6.0](#upgrading-to-v480--react-v060)| March 2026 | No breaking changes | 🟢 Low - only relevant if you adopted the earlier TextInput prototype |
13
-
|[v4.7.0 / React v0.5.0](#upgrading-to-v470--react-v050)| March 2026 | Card family realignment | 🟡 Medium - API migration recommended |
14
-
|[v4.6.0 / React v0.4.0](#upgrading-to-v460--react-v040)| March 2026 | Tag default + naming | 🟡 Medium - Search/replace recommended |
9
+
| Version | Date | Breaking Changes | Migration Complexity |
|[React v0.8.0](#upgrading-to-react-v080)| April 2026 | React `spritePath` removal | 🟢 Low - Remove the deprecated prop |
12
+
|[v4.9.0 / React v0.7.0](#upgrading-to-v490--react-v070)| April 2026 | Icon naming sync | 🟡 Medium - Search/replace icon names |
13
+
|[v4.8.0 / React v0.6.0](#upgrading-to-v480--react-v060)| March 2026 | No breaking changes | 🟢 Low - only relevant if you adopted the earlier TextInput prototype |
14
+
|[v4.7.0 / React v0.5.0](#upgrading-to-v470--react-v050)| March 2026 | Card family realignment | 🟡 Medium - API migration recommended |
15
+
|[v4.6.0 / React v0.4.0](#upgrading-to-v460--react-v040)| March 2026 | Tag default + naming | 🟡 Medium - Search/replace recommended |
15
16
|[v4.5.0](#upgrading-to-v450)| March 2026 | Spacing and typography API changes | 🟡 Medium - Replace legacy APIs and recheck overrides |
16
-
|[v4.3.0 / React v0.2.0](#upgrading-to-v430--react-v020)| March 2026 | Button variant naming | 🟡 Medium - Find/replace required |
17
-
|[v4.1.0](#upgrading-to-v410)| February 2026 | Spacing scale indices | 🟡 Medium - Index updates required |
`@ourfuturehealth/react-components` removes the `spritePath` prop from the public `Icon` API and from `Card` icon configuration. React icons now always render from bundled toolkit SVG data.
33
+
34
+
### Migration Steps
35
+
36
+
1. Remove any `spritePath` prop from `Icon` usage.
37
+
2. Remove any `spritePath` field from `Card` icon configuration objects.
38
+
3. Re-run visual checks for icon-bearing surfaces such as `Icon`, `Select`, `Card`, and `Checkboxes`.
If an application previously passed `spritePath` in React, that prop should now be removed.
68
+
69
+
### Toolkit reminder
70
+
71
+
Toolkit/Nunjucks icon consumers are unchanged. They must still serve `icon-sprite.svg` at a public URL, default `/assets/icons/icon-sprite.svg`, or override that URL with `spritePath`.
Copy file name to clipboardExpand all lines: docs/contributing/material-icons.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,6 +111,8 @@ The macro renders:
111
111
- An `<svg>` element with `.ofh-icon` classes
112
112
- A `<use href="/assets/icons/icon-sprite.svg#ofh-icon-<name>">`
113
113
114
+
Toolkit consumers must make that sprite file available at a public URL the browser can request. Installing the package places the file in `node_modules/@ourfuturehealth/toolkit/assets/icons/icon-sprite.svg`, but the consuming app still needs to copy or serve it as `/assets/icons/icon-sprite.svg`, or override the URL with `spritePath`.
115
+
114
116
Example usage:
115
117
116
118
```njk
@@ -133,7 +135,7 @@ React icon names should stay aligned with toolkit `manifest.json` and the genera
133
135
Current React approach:
134
136
135
137
- Reuses the toolkit sprite semantics (`name`, `size`, responsive sizing, decorative vs titled)
136
-
-Defaults to the bundled toolkit sprite asset and references symbols with `<use>`
138
+
-Bundles toolkit icon data into the React package and renders the requested symbol inline
137
139
- Treats icon-name changes as consumer-facing API changes that must be documented in release notes and the upgrading guide
138
140
139
141
Related package: [`packages/react-components/`](../../packages/react-components/)
Toolkit assets are available under `node_modules/@ourfuturehealth/toolkit/assets/`.
158
158
159
+
If you use the toolkit `icon` macro or any toolkit component that renders an icon, your app must also publish the sprite file at a browser-visible URL. The default toolkit path is `/assets/icons/icon-sprite.svg`, so the usual setup is to copy:
Copy file name to clipboardExpand all lines: packages/example-react-consumer-app/README.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,9 @@ This app is intentionally configured as a standalone published-consumer example:
7
7
- it installs the released `@ourfuturehealth/react-components` tarball
8
8
- it imports the published theme stylesheet bundle
9
9
- it does not use the monorepo workspace protocol
10
+
- it exercises icon-bearing components such as `Icon`, `Select`, `Card`, and `Checkboxes`
11
+
12
+
The dependency in `package.json` intentionally stays on the current published release tag. For unreleased branch validation, use the local tarball workflow below.
10
13
11
14
## Install and run
12
15
@@ -29,6 +32,7 @@ pnpm dev:react-consumer
29
32
- a published tarball install works in a real consumer app
30
33
- the exported React components render in a Vite application
31
34
- the published stylesheet entrypoints load correctly
35
+
- current input-family and icon-bearing components can be smoke-tested outside Storybook
32
36
33
37
This makes it useful as guidance for future React consumers outside the toolkit repo.
0 commit comments