Skip to content

Add migration from iTwinUI guide - #1643

Open
GerardasB wants to merge 34 commits into
mainfrom
gerardas/itwinui-migration
Open

GerardasB wants to merge 34 commits into
mainfrom
gerardas/itwinui-migration

Conversation

@GerardasB

@GerardasB GerardasB commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Changes

This PR adds a migration guide that describes how to migrate from iTwinUI to StrataKit.

Currently it is mostly intended to expose the iTwinUI -> StrataKit icon mappings available in https://www.figma.com/design/fVdjw14c6U6qRjzZwUwq9x/Icons-Parity-iTwinUI-vs-Strata

In addition I've filled out the initial ## Migration steps based on structure of legacy StrataKit migration.
Other information, like component mapping/guidance will be filled out later.

Note to reviewers: Icon mappings will need some work/validations, see comments below.

Created a script to extract available iTwinUI icons: #1643 (comment)

Testing

https://stratakit.bentley.com/1643/docs/getting-started/migration-from-itwinui/

Comment thread apps/website/src/content/docs/getting-started/migration-from-itwinui.mdx Outdated
Comment thread apps/website/src/content/docs/getting-started/migration-from-itwinui.mdx Outdated
Comment thread apps/website/src/content/docs/getting-started/migration-from-itwinui.mdx Outdated
Comment thread apps/website/src/content/docs/getting-started/migration-from-itwinui.mdx Outdated
Comment thread apps/website/src/content/docs/getting-started/migration-from-itwinui.mdx Outdated
Comment thread apps/website/src/content/docs/getting-started/migration-from-itwinui.mdx Outdated
@GerardasB
GerardasB marked this pull request as ready for review August 7, 2026 11:09
@GerardasB
GerardasB requested a review from a team as a code owner August 7, 2026 11:09
@GerardasB
GerardasB requested review from FlyersPh9 and mayank99 and removed request for a team August 7, 2026 11:09

@FlyersPh9 FlyersPh9 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely structured page. I read through all of it and it made sense. However, I did not review the icon mapping and will defer to the designers on that.

@GerardasB
GerardasB force-pushed the gerardas/itwinui-migration branch from da07b31 to 20c0cc8 Compare September 1, 2026 15:32
@GerardasB

GerardasB commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

While working on iTwin/appui#1587 I've noticed that some mappings in the table are incorrect. Pushed a bunch of changes.

This gives some ground to run a script that verifies existence of SVGs in the second column.


After running a script there are some more fixes to be made:

Script
import { readFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";

import iconsList from "./packages/icons/icons-list.json" with { type: "json" };

const mdxPath = fileURLToPath(
	new URL(
		"./apps/website/src/content/docs/getting-started/migration-from-itwinui.mdx",
		import.meta.url,
	),
);

const content = (await readFile(mdxPath, "utf8")) as string;

let isHeader = true;
const badIcons: string[] = [];
for (const line of content.split("\n")) {
	const trimmed = line.trim();

	// Consider table only
	if (!trimmed.startsWith("|") || !trimmed.endsWith("|")) continue;

	// Skip header
	if (isHeader) {
		if (line.startsWith("| --")) {
			isHeader = false;
		}
	}

	const cells = trimmed
		.slice(1, -1)
		.split("|")
		.map((cell) => cell.trim());

	const [_, icon] = cells;
	if (icon === "-") continue;
	if (iconsList.includes(icon)) continue;

	badIcons.push(icon);
}

console.table(badIcons);
Output
┌─────────┬────────────────────────────────┐
│ (index) │ Values                         │
├─────────┼────────────────────────────────┤
│ 0       │ 'remove.svg'                   │
│ 1       │ 'column-manager.svg'           │
│ 2       │ 'distribute-bottom.svg'        │
│ 3       │ 'folder-minimize.svg'          │
│ 4       │ 'forms.svg'                    │
│ 5       │ 'hide-manually-suppressed.svg' │
│ 6       │ 'hide-rule-suppressed.svg'     │
│ 7       │ 'plugin.svg'                   │
│ 8       │ 'suppress-manually.svg'        │
│ 9       │ 'tree-navigate-down.svg'       │
│ 10      │ 'tree-navigate-up.svg'         │
│ 11      │ 'visibility-emphasize.svg'     │
└─────────┴────────────────────────────────┘

Fixed now

Comment on lines +79 to +95
4. **Replace usage of `@itwin/itwinui-react`**

Replace the usage of components from `@itwin/itwinui-react` with their [StrataKit counterparts](/components/overview/).

Some components are provided by `@mui/material`.

```diff
- import { Button } from '@itwin/itwinui-react';
+ import Button from "@mui/material/Button";
```

Others live in `@stratakit/structures`.

```diff
- import { Tree } from '@itwin/itwinui-react';
+ import { Tree } from "@stratakit/structures";
```

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step 4 makes it seem like it would be enough to replace the imports. Should briefly clarify that the usage itself will need to be updated.

In a future PR, we can add a separate section that lists all components and their replacements, linking to each one's docs.

<ThemeProvider
theme={theme}
as={Root}
colorScheme="light"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be colorScheme={theme}.

- <SvgAdd />

+ import { Icon } from "@stratakit/mui";
+ import svgAdd from "@stratakit/icons/add.svg";

@mayank99 mayank99 Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After #1863, the .svg extension can be removed.

Suggested change
+ import svgAdd from "@stratakit/icons/add.svg";
+ import { svgAdd } from "@stratakit/icons/add";

This guide provides the necessary steps for migrating from [iTwinUI](https://itwinui.bentley.com/) to StrataKit.

:::note
Migration to StrataKit can be done gradually, since iTwinUI can coexist in the same application by utilizing the [StrataKit theme bridge](https://github.com/iTwin/iTwinUI/wiki/StrataKit-theme-bridge). To facilitate a visual transition, you may want to use StrataKit's "cobalt" [accent color](/components/root/#accent-color), which is designed for better compatibility with iTwinUI's color palette.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "accent color" part feels bolted on here. Might be worth explaining in its own paragraph or separate section.


| iTwinUI icon | StrataKit icon |
| ----------------------------- | --------------------------------- |
| 2d | 2d.svg |

@mayank99 mayank99 Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iTwinUI icons are often used directly as React components from @itwin/itwinui-icons-react. Is it worth including those in this list? That would make it easy to search.

2d (`Svg2D`)

Similarly, StrataKit icons can include the named exports from #1863:

2d (`svg2D`)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants