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;