Skip to content

Commit

Permalink
[docs] Add migration guide for the Tree View (#9987)
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviendelangle authored Aug 14, 2023
1 parent a0024a6 commit b4d7611
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ productId: x-date-pickers

# Migration from the lab

<p class="description">MUI date and time pickers are now available on MUI X!</p>
<p class="description">MUI Date and Time Pickers are now available on MUI X!</p>

## Introduction

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
productId: x-tree-view
---

# Migration from the lab

<p class="description">MUI Tree View is now available on MUI X!</p>

## Introduction

This is a reference for migrating your site's tree view from `@mui/lab` to `@mui/x-tree-view`.
This migration is about the npm packages used, it **does not** affect the behavior of the components in your application.

[//]: # 'You can find why we are moving in this direction in the [announcement blog post](/blog/lab-tree-view-to-mui-x/).'

## Migration steps

### 1. Install MUI X package

<codeblock storageKey="package-manager">
```bash npm
npm install @mui/x-tree-view
```

```bash yarn
yarn add @mui/x-tree-view
```

```bash pnpm
pnpm add @mui/x-tree-view
```

</codeblock>

### 2. Run the code mod

We have prepared a codemod to help you migrate your codebase.

You can either run it on a specific file, folder, or your entire codebase when choosing the `<path>` argument.

```bash
npx @mui/codemod v5.0.0/tree-view-moved-to-x <path>
```

Which will transform the imports like this:

```diff
-import TreeView from '@mui/lab/TreeView';
+import { TreeView } from '@mui/x-tree-view/TreeView';

-import { TreeView, TreeItem } from '@mui/lab';
+import { TreeView, TreeItem } from '@mui/x-tree-view';
```
4 changes: 4 additions & 0 deletions docs/data/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@ const pages: MuiPage[] = [
pathname: '/x/migration/migration-pickers-v5',
title: 'Breaking changes: Date and Time Pickers',
},
{
pathname: '/x/migration/migration-tree-view-lab',
title: 'Migration from lab to v6 (Tree View)',
},
],
},
{
Expand Down
7 changes: 7 additions & 0 deletions docs/pages/x/migration/migration-tree-view-lab.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as React from 'react';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from 'docsx/data/migration/migration-tree-view-lab/migration-tree-view-lab.md?@mui/markdown';

export default function Page() {
return <MarkdownDocs {...pageProps} />;
}

0 comments on commit b4d7611

Please sign in to comment.