首页 > 解决方案 > 如何在 Material UI 快速拨号按钮中添加文本?

问题描述

如何更改材质ui快速拨号按钮,显然它使用Fab默认值,您所能做的就是更改Icon,但我还需要添加一个文本,例如:

<Fab variant="extended">
    <NavigationIcon />
    Actions
</Fab>

标签: buttonmaterial-uifrontendcustomizationspeed-dial

解决方案


  1. 用于SpeedDialAction此目的
    <SpeedDialAction
       key={action.name}
       icon={action.icon} // here goes your icon
       tooltipTitle={action.name} // here goes your text
       tooltipOpen
       onClick={handleClose}
    />

悬停时你会看到 在此处输入图像描述

  1. 或根据您的目的使用浮动操作按钮
    <Fab
        aria-label={fab.label}
        className={fab.className}
        color={fab.color}
    >
        {fab.icon}
    </Fab>

在此处输入图像描述


请让我知道它是否适合您)


推荐阅读