ReactJS MUI 5 如何将过渡添加到 opening/closing 抽屉

ReactJS MUI 5 how to add transition to an opening/closing drawer

使用 this as a reference I've created a collapsible drawer that shrinks the content area next to it. Here is the codesandbox. My question is how to add a smooth transition as in this example 但不使用 styled。我在 codesandbox 中尝试过类似的东西,但它确实很奇怪。

您想要的是抽屉变体 persistent

从此更改第 53 行

variant={openDrawer ? "permanent" : "temporary"}

对此:

variant="persistent"

那是我更改的唯一一行,现在效果很好。