https://codesandbox.io/s/qqqk23x3q
tab-demo.js
<td>
<ChipsButton
className={classes.chipContainer}
chipName="button test IPA"
// menuItems={IPAMenuItems}
//ChipsButton
/>
</td>
**chips-dialog.js**
<Menu
className={classes.chipButtonContainer}
id="simple-menu"
// anchorEl={anchorEl}
open={open}
onClose={this.handleClose}
>
<MenuItem className={classes.chipButtonContainerHeader}>
{this.state.menuText}
</MenuItem>
<Button
className={classes.chipButtonContainerButton}
key={1}
style={{
backgroundColor:
this.state.menuText === "Active selected" ? "green" : ""
}}
// style={{ display: this.state.display ? "none" : "" }}
// aria-owns={anchorEl ? 'simple-menu' : undefined}
aria-haspopup="true"
value={"Active"}
onClick={this.handleSelect}
>
Active
</Button>
<Button
key={2}
style={{
backgroundColor:
this.state.menuText === "Inactive selected" ? "green" : ""
}}
value={"Inactive"}
// style={{ display: this.state.display ? "none" : "" }}
// aria-owns={anchorEl ? 'simple-menu' : undefined}
aria-haspopup="true"
onClick={this.handleSelect}
>
Inactive
</Button>
</Menu>
const styles = theme => ({
chipButtonContainer: {
border: "1px solid brown",
padding: "0"
},
chipButtonContainerHeader: {
backgroundColor: "green",
border: "1px solid pink"
},
chipButtonContainerButton: {
border: "1px solid black"
}
})
;
答案 0 :(得分:1)
将MenuListProps
转发到基础List
组件(由MenuList
组成)以禁用应用于其的填充。
可以在chips-dialog.js
<Menu
className={classes.chipButtonContainer}
//...
MenuListProps={{ disablePadding: true }}
onClose={this.handleClose}
>
<!--...-->
</Menu>
答案 1 :(得分:0)
对于带有 <Select>
的 MenuProps
组件的工作方式相同
<Select
multiple
input={<Input />}
MenuProps={{
MenuListProps: {
disablePadding: true
}}>
{employees.map((employee) => (
<MenuItem key={employee.id} value={employee.id}>
{employee.name}
</MenuItem>
))}
</Select>