I'm trying to create a split button with the use of Material UI components like ButtonGroup
and Button
: https://material-ui.com/components/button-group/#split-button .
The problem is the first button can be disabled and also show a tooltip when it's disabled. The recommendation is to wrap the button with span
, but then it breaks the styling of the buttons. Is there any solution for this or I have to use custom styling for the buttons?
The code I use:
<ButtonGroup variant="contained" color="primary" aria-label="split button">
<Tooltip title="You don't have permission to do this">
<span>
<Button disabled onClick={handleClick}>Send</Button>
</span>
</Tooltip>
<Button onClick={handleToggle}>
<ArrowDropDownIcon />
</Button>
</ButtonGroup>
Just add style to span;
background-color: rgba(0, 0, 0, 0.12) //same color used for disabled button
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.