如何将材质ui图标居中放置在按钮中?
import AddIcon from '@material-ui/icons/Add';
<Button><AddIcon style={{ bottom: 3, right: 3 }}/>ADD</Button>
答案 0 :(得分:0)
有一种特殊类型的按钮,称为带有图标和标签的按钮。
您可以详细了解here。
答案 1 :(得分:0)
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
...
const useStyles = makeStyles({
root: {
background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)',
borderRadius: 3,
border: 0,
color: 'white',
height: 48,
padding: '0 30px',
boxShadow: '0 3px 5px 2px rgba(255, 105, 135, .3)',
},
label: {
textTransform: 'capitalize',
},
});
...
const classes = useStyles();
return (
<AddIcon
classes={{
root: classes.root,
label: classes.label,
}}
>