英文:
Adding text to Toggle Menu of a Persistent Drawer in Material UI
问题
我想在切换抽屉持久存在的按钮所在区域(我已经圈出来了)添加一些文本。这可能吗?如果是的话,我应该如何实现这一点?
我查看了 Stack Overflow 和 Material UI 的文档,似乎没有关于我的问题的答案。
英文:
I would like to add some text in the area (which I've circled) that has the toggle button for persistent drawers. Is this possible? If so, how would I implement this?
I looked through Stack Overflow and Material UI's documentation and there appears to be no answers to this question of mine.
答案1
得分: 0
你可以在DrawerHeader
组件中添加任何你想要的文本,就像这样(在这种情况下是"custom header text"):
<DrawerHeader>
custom header text
<IconButton onClick={handleDrawerClose}>
{theme.direction === "ltr" ? (
<ChevronLeftIcon />
) : (
<ChevronRightIcon />
)}
</IconButton>
</DrawerHeader>
你可以在这个沙盒中查看一个实时的工作示例。
英文:
You can add any text you want in DrawerHeader
component like this (in this case "custom header text"):
<DrawerHeader>
custom header text
<IconButton onClick={handleDrawerClose}>
{theme.direction === "ltr" ? (
<ChevronLeftIcon />
) : (
<ChevronRightIcon />
)}
</IconButton>
</DrawerHeader>
You can take a look at this sandbox for a live working example.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论