Layout Components (Container, Row, Col)
import React from 'react';
import { Container, Row, Col } from 'reactstrap';
export default class Example extends React.Component {
render() {
return (
<Container>
<Row>
<Col>.col</Col>
</Row>
<Row>
<Col>.col</Col>
<Col>.col</Col>
<Col>.col</Col>
<Col>.col</Col>
</Row>
<Row>
<Col xs="3">.col-3</Col>
<Col xs="auto">.col-auto - variable width content</Col>
<Col xs="3">.col-3</Col>
</Row>
<Row>
<Col xs="6">.col-6</Col>
<Col xs="6">.col-6</Col>
</Row>
<Row>
<Col xs="6" sm="4">.col-6 .col-sm-4</Col>
<Col xs="6" sm="4">.col-6 .col-sm-4</Col>
<Col sm="4">.col-sm-4</Col>
</Row>
<Row>
<Col sm={{ size: 6, order: 2, offset: 1 }}>.col-sm-6 .order-sm-2 .offset-sm-1</Col>
</Row>
<Row>
<Col sm="12" md={{ size: 6, offset: 3 }}>.col-sm-12 .col-md-6 .offset-md-3</Col>
</Row>
<Row>
<Col sm={{ size: 'auto', offset: 1 }}>.col-sm-auto .offset-sm-1</Col>
<Col sm={{ size: 'auto', offset: 1 }}>.col-sm-auto .offset-sm-1</Col>
</Row>
</Container>
);
}
}
Container Properties
Container.propTypes = {
fluid: PropTypes.bool
// applies .container-fluid class
}
Row Properties
Row.propTypes = {
noGutters: PropTypes.bool,
// see https://reactstrap.github.io/components/form Form Grid with Form Row
form: PropTypes.bool
}
Col Properties
const stringOrNumberProp = PropTypes.oneOfType([PropTypes.number, PropTypes.string]);
const columnProps = PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
PropTypes.bool,
PropTypes.shape({
size: PropTypes.oneOfType([PropTypes.bool, PropTypes.number, PropTypes.string]),
// example size values:
// 12 || "12" => col-12 or col-`width`-12
// auto => col-auto or col-`width`-auto
// true => col or col-`width`
order: stringOrNumberProp,
offset: stringOrNumberProp
})
]);
Col.propTypes = {
xs: columnProps,
sm: columnProps,
md: columnProps,
lg: columnProps,
xl: columnProps,
// override the predefined width (the ones above) with your own custom widths.
// see https://github.com/reactstrap/reactstrap/issues/297#issuecomment-273556116
widths: PropTypes.array,
}
当前内容版权归 reactstrap 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 reactstrap .