Is it possible to add "flex-grow" to a Grid item in material ui? Seams a bit weird that I have to choose Box in order to get access to Flexbox https://material-ui.com/system/flexbox/?
是否可以向材质UI中的网格项目添加“Flex-Growth”?Seams有点奇怪,我必须选择盒子才能访问Flexbox https://material-ui.com/system/flexbox/?
更多回答
优秀答案推荐
Yes, you can add flex-grow
using the style attribute.
可以,您可以使用style属性添加flex-Growth。
<Grid item style={{ flexGrow: 1 }}>
<Typography variant="h1" color="textPrimary" >
Title
</Typography>
</Grid>
or you can create a separate class for multiple Grid items.
或者,您可以为多个网格项目创建单独的类。
This is similar to Amir's answer, but uses a styled component:
这与Amir的回答类似,但使用了样式组件:
const StyledGridItem = styled(Grid)({
flexGrow: 1
})
Then implemented...
然后实施了..。
<StyledGridItem item>
// contents of grid item here
</StyledGridItem>
更多回答
我是一名优秀的程序员,十分优秀!