react-bootstrap 卡片网格布局
md={4} 代表每行显示4个卡片
g-2 代表卡片间的间距
import React, { useState, useEffect } from 'react';
import {
Container,
Row,
Col,
Stack,
Form,
Button,
Alert,
ToggleButtonGroup,
ToggleButton,
ButtonToolbar,
ButtonGroup,
InputGroup,
FormControl,
Dropdown,
DropdownButton,
Card,
} from 'react-bootstrap';
function LoadingButton() {
const [value, setValue] = useState([1, 3]);
/*
* The second argument that will be passed to
* `handleChange` from `ToggleButtonGroup`
* is the SyntheticEvent object, but we are
* not using it in this example so we will omit it.
*/
const handleChange = (val) => setValue(val);
return (
<div className="m-test-wrap">
<Row md={4} className="g-2">
{Array.from({ length: 8 }).map((_, idx) => (
<Col key={idx}>
<Card>
<Card.Body>
<Card.Title>Card title{idx + 1}</Card.Title>
<Card.Text>
This is a longer card with supporting text below as a natural
lead-in to additional content. This content is a little bit
longer.
</Card.Text>
</Card.Body>
</Card>
</Col>
))}
</Row>
</div>
);
}
export default LoadingButton;
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步