-
Notifications
You must be signed in to change notification settings - Fork 39
iTwinUI react v2 migration guide
To help with the migration (for breaking changes), we also provide a semi-automated migration tool that scans your project repo for old code and recommends replacements.
Download options:
- Clone iTwinUI-migration-tool GitHub repo (recommended)
- Download zip file (version: 24 Sep 2024) with the tool (for users outside the iTwin GitHub org)
This wiki page is to document all of the changes occurring to iTwinUI-react v2. This includes things like component name changes, component structure changes, visual changes, file renames and moves, and deprecation.
- πβπ¨ signifies a significant visual change
- β signifies a breaking change that must be updated by users
There are also migration guides available for the other two iTwinUI packages:
- iTwinUI-css v1 migration guide (v0 -> v1)
- iTwinUI-variables v1 migration guide (Sass variables -> CSS variables)
- We have officially ended support of Internet Explorer. If you still need IE support, please contact the team or make an issue.
- πβπ¨ The prioritized font has changed. The sans font now prioritizes 'Noto Sans' and the mono font now prioritizes 'Noto Sans Mono'. The previous fonts have not been deprecated. See the updated list here.
- πβπ¨ Line height has changed from 22px to
--iui-size-l
(24px). This change visually affects most components. - πβπ¨ All four theme colors have been updated.
- The base themes (light and dark) meet WCAG AA contrast score.
- The high contrast themes (high contrast light and high contrast dark) meet WCAG AAA contrast score.
As of the latest 2.x version, iTwinUI-react no longer depends on: @itwin/itwinui-icons-react
, @itwin/itwinui-css
, @itwin/itwinui-variables
.
- iTwinUI components that internally need SVGs will inline them. If you need to use one of our icons in your app, please manually install the latest
@itwin/itwinui-icons-react
package. - Prior to v2.12.0, iTwinUI-react had direct dependencies on
@itwin/itwinui-css
@1.x
,@itwin/itwinui-variables
@2.x
. In v2.12.0, these dependencies were removed, and the CSS produced by both of these packages is inlined into iTwinUI-react. -
@itwin/itwinui-illustrations-react
is only used in the now-deprecatedErrorPage
and will be removed in the next major version. If you need to use the illustrations standalone, please install the package manually. If you are usingErrorPage
, please consider usingNonIdealState
instead.
- The theming method using
useTheme
has been deprecated. Please useThemeProvider
instead. Instructions can be found in the README.
It may not be feasible for your app to upgrade entirely to iTwinUI v2 all at once. To alleviate this, we have added the ability to incrementally migrate to v2 for parts of your app, while still using v1 for the rest of the page.
To use this feature, make sure all parts that use v1 are updated to at least @itwin/[email protected]
- you might need (p)npm overrides to do this. Then install @itwin/[email protected]
(or later), and wrap your v2 parts in ThemeProvider
.
<body>
<!-- rest of your app (v1) -->
<ThemeProvider>
<!-- new UI built using v2 -->
</ThemeProvider>
</body>
When designing a package that uses iTwinUI v2 but is intended to be used by apps that might still be using iTwinUI v1 elsewhere, make sure to wrap all entrypoints of your package with <ThemeProvider theme='inherit'>
.
<ThemeProvider theme='inherit'>
<!-- package entrypoint -->
</ThemeProvider>
For more details and a demo, see "iTwinUI 1.x and 2.x coexisting".
iTwinUI now uses rem
units instead of px
for spacing. Doing this allows the components to automatically scale with the base font size specified by the end user's operating system and/or browser settings. However, for this to work, your page must not use a constant pixel value for the font-size of the root element.
html {
font-size: 14px; // β don't do this
}
If there is a font-size already set on the root element (perhaps through some third-party styles), then you can unset
it or use 100%
.
html {
font-size: 100% !important;
}
And if you would like to control the size of most text on the page, you can still do so by setting it on the body
, as it will get inherited by every element on the page.
body {
font-size: 0.875rem;
}
To see examples of the components, visit the storybook page.
-
Table
- β The formatting for the table header has changed. The first level header should be removed from a table's column definition.
- Previous format:
[{ Header: '', columns: [ ...columns info... ] }]
- New format:
[ ...columns info... ]
- Previous format:
- The old format will also continue to work if you update to version
2.5.0
or later.
- β The formatting for the table header has changed. The first level header should be removed from a table's column definition.
-
Alert
- β The previously deprecated property
onClick
has been removed and can no longer be used. Instead, useclickableTextProps
.
- β The previously deprecated property
-
Tab
(singular)- β The previously deprecated
HorizontalTab
has been removed and can no longer be used. UseTab
instead. - β The previously deprecated
HorizontalTabProps
has been removed and can no longer be used. UseTabProps
instead.
- β The previously deprecated
-
Checkbox
andRadio
- β The previously deprecated property
checkmarkClassName
has been removed and can no longer be used. This is applied on the actual checkbox/radio<input>
element. The checkmark has been moved into a pseudo-element. - β The previously deprecated property
checkmarkStyle
has been removed and can no longer be used. This is applied on the actual checkbox/radio<input>
element. The checkmark has been moved into a pseudo-element.
- β The previously deprecated property
-
Header
- The property
userIcon
has been deprecated. Avatars (previously user icons) can now be part of theactions
property list.
- The property
-
ErrorPage
has been deprecated and is now calledNonIdealState
. UsingNonIdealState
instead ofErrorPage
allows the client bundle to be smaller, as it doesn't have to import all of the images used inErrorPage
. Note thatNonIdealState
has been completely reworked to achieve this goal. Rather than using the propertyerrorType
to select what type of image to show, use the propertysvg
to apply the image of your choosing.-
ErrorPage
>NonIdealState
-
ErrorPageProps
>NonIdealStateProps
-
ErrorPageTypes
has been deprecated. -
ErrorTypeTranslations
has been deprecated.
-
-
Tabs
(plural, container) -HorizontalTabs
andVerticalTabs
have been deprecated. UseTabs
with the appropriate properties.-
HorizontalTabs
>Tabs
(defaults to horizontal, but can also use propertyorientation = 'horizontal'
) -
VerticalTabs
>Tabs
with propertyorientation = 'vertical'
-
HorizontalTabsProps
andVerticalTabsProps
>TabsProps
-
- Theming
-
ownerDocument
has been deprecated fromThemeOptions
. RenderThemeProvider
in the correct document instead.
-
- Typography - Several text components have been deprecated. Use
Text
with the appropriate properties.-
Headline
>Text
with propertyvariant = 'headline'
-
Title
>Text
with propertyvariant = 'title'
-
Subheading
>Text
with propertyvariant = 'subheading'
-
Leading
>Text
with propertyvariant = 'leading'
-
Body
>Text
with propertyvariant = 'body'
-
Small
>Text
with propertyvariant = 'small'
-
-
UserIcon
has been deprecated and is now calledAvatar
.-
UserIcon
>Avatar
-
UserIconProps
>AvatarProps
-
UserIconStatus
>AvatarStatus
-
-
UserIconGroup
has been deprecated and is now calledAvatarGroup
.-
UserIconGroup
>AvatarGroup
-
UserIconGroupProps
>AvatarGroupProps
-
-
Wizard
has been deprecated and is now separated intoStepper
andWorkflowDiagram
.Stepper
is used for the βbasicβ and βlongβ types of wizard.WorkflowDiagram
is used for the βworkflowβ type of wizard. Continue using propertytype
forStepper
.WorkflowDiagram
has no propertytype
as there is only one type β workflow.-
Wizard
>Stepper
orWorkflowDiagram
-
WizardProps
>StepperProps
orWorkflowDiagramProps
-
WizardLocalization
>StepperLocalization
-
-
Alert
- The html formatting has changed for the close button. Previously the close button was composed of an
IconButton
, but is now made with<button/>
. Additionally, the icon now has the class name 'iui-alert-button-icon'.
- The html formatting has changed for the close button. Previously the close button was composed of an
-
Button
- The class name "iui-button-label" has been removed from the
span
that surrounds a button's children. -
Button
no longer passes class names tostartIcon
andendIcon
.
- The class name "iui-button-label" has been removed from the
- ComboBox
- The virtualized combobox menu now applies a class name of 'iui-scroll' to the menu. This is also where class names can now be applied to the virtualized combobox menu.
-
Header
- The html formatting has changed for the header's breadcrumbs. The breadcrumbs are now represented as
<li/>
and are surrounded by a container<ol/>
.
- The html formatting has changed for the header's breadcrumbs. The breadcrumbs are now represented as
-
IconButton
-
IconButton
no longer passes class names to icon.
-
-
SplitButton
- The html formatting has changed. Previously
SplitButton
was formatted with<span> <div> <Button/> </div> <div> <DropdownMenu/> </div> </span>
but now the divs have been dropped so that the formatting is now<span <Button/> <DropdownMenu/> </span>
.
- The html formatting has changed. Previously
- πβπ¨
Alert
: Visuals have changed to meet accessibility requirements. Sticky alert is now offset from top and sides of the window. - πβπ¨
SideNavigation
: Visuals have changed. - πβπ¨
Table
,Checkbox
, &Tile
: Visual styling for disabled and loading are now the same acrossTable
,Checkbox
, andTile
. - πβπ¨
Toast
: Visuals have changed. - πβπ¨
Tree
: No longer transparent and has a background.
-
Table
- Added property
isLoading
to table rows. - Added counter to paginated tables that shows how many rows have been selected if multi-selection mode is enabled.
- Updated keyboard navigation support for sorting and filtering.
- Added property
-
Tile
- Added properties
status
,isLoading
, andisDisabled
to tile.
- Added properties