ListGroup

List Group - 图1

  1. import React from 'react';
  2. import { ListGroup, ListGroupItem } from 'reactstrap';
  3. export default class Example extends React.Component {
  4. render() {
  5. return (
  6. <ListGroup>
  7. <ListGroupItem>Cras justo odio</ListGroupItem>
  8. <ListGroupItem>Dapibus ac facilisis in</ListGroupItem>
  9. <ListGroupItem>Morbi leo risus</ListGroupItem>
  10. <ListGroupItem>Porta ac consectetur ac</ListGroupItem>
  11. <ListGroupItem>Vestibulum at eros</ListGroupItem>
  12. </ListGroup>
  13. );
  14. }
  15. }

Properties

  1. ListGroup.propTypes = {
  2. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
  3. // boolean to render list group items edge-to-edge in a parent container
  4. flush: PropTypes.bool,
  5. className: PropTypes.string,
  6. cssModule: PropTypes.object,
  7. }

TagsList Group - 图2

  1. import React from 'react';
  2. import { ListGroup, ListGroupItem, Badge } from 'reactstrap';
  3. export default class Example extends React.Component {
  4. render() {
  5. return (
  6. <ListGroup>
  7. <ListGroupItem className="justify-content-between">Cras justo odio <Badge pill>14</Badge></ListGroupItem>
  8. <ListGroupItem className="justify-content-between">Dapibus ac facilisis in <Badge pill>2</Badge></ListGroupItem>
  9. <ListGroupItem className="justify-content-between">Morbi leo risus <Badge pill>1</Badge></ListGroupItem>
  10. </ListGroup>
  11. );
  12. }
  13. }

Disabled itemsList Group - 图3

  1. import React from 'react';
  2. import { ListGroup, ListGroupItem } from 'reactstrap';
  3. export default class Example extends React.Component {
  4. render() {
  5. return (
  6. <ListGroup>
  7. <ListGroupItem disabled tag="a" href="#">Cras justo odio</ListGroupItem>
  8. <ListGroupItem tag="a" href="#">Dapibus ac facilisis in</ListGroupItem>
  9. <ListGroupItem tag="a" href="#">Morbi leo risus</ListGroupItem>
  10. <ListGroupItem tag="a" href="#">Porta ac consectetur ac</ListGroupItem>
  11. <ListGroupItem tag="a" href="#">Vestibulum at eros</ListGroupItem>
  12. </ListGroup>
  13. );
  14. }
  15. }

Anchors and buttonsList Group - 图4

  1. import React from 'react';
  2. import { ListGroup, ListGroupItem } from 'reactstrap';
  3. export default class Example extends React.Component {
  4. render() {
  5. return (
  6. <div>
  7. <h3>Anchors </h3>
  8. <p>Be sure to <strong>not use the standard <code>.btn</code> classes here</strong>.</p>
  9. <ListGroup>
  10. <ListGroupItem active tag="a" href="#" action>Cras justo odio</ListGroupItem>
  11. <ListGroupItem tag="a" href="#" action>Dapibus ac facilisis in</ListGroupItem>
  12. <ListGroupItem tag="a" href="#" action>Morbi leo risus</ListGroupItem>
  13. <ListGroupItem tag="a" href="#" action>Porta ac consectetur ac</ListGroupItem>
  14. <ListGroupItem disabled tag="a" href="#" action>Vestibulum at eros</ListGroupItem>
  15. </ListGroup>
  16. <p />
  17. <h3>Buttons </h3>
  18. <ListGroup>
  19. <ListGroupItem active tag="button" action>Cras justo odio</ListGroupItem>
  20. <ListGroupItem tag="button" action>Dapibus ac facilisis in</ListGroupItem>
  21. <ListGroupItem tag="button" action>Morbi leo risus</ListGroupItem>
  22. <ListGroupItem tag="button" action>Porta ac consectetur ac</ListGroupItem>
  23. <ListGroupItem disabled tag="button" action>Vestibulum at eros</ListGroupItem>
  24. </ListGroup>
  25. </div>
  26. );
  27. }
  28. }

Contextual classesList Group - 图5

  1. import React from 'react';
  2. import { ListGroup, ListGroupItem } from 'reactstrap';
  3. export default class Example extends React.Component {
  4. render() {
  5. return (
  6. <ListGroup>
  7. <ListGroupItem color="success">Cras justo odio</ListGroupItem>
  8. <ListGroupItem color="info">Dapibus ac facilisis in</ListGroupItem>
  9. <ListGroupItem color="warning">Morbi leo risus</ListGroupItem>
  10. <ListGroupItem color="danger">Porta ac consectetur ac</ListGroupItem>
  11. </ListGroup>
  12. );
  13. }
  14. }

Custom contentList Group - 图6

  1. import React from 'react';
  2. import { ListGroup, ListGroupItem, ListGroupItemHeading, ListGroupItemText } from 'reactstrap';
  3. export default class Example extends React.Component {
  4. render() {
  5. return (
  6. <ListGroup>
  7. <ListGroupItem active>
  8. <ListGroupItemHeading>List group item heading</ListGroupItemHeading>
  9. <ListGroupItemText>
  10. Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.
  11. </ListGroupItemText>
  12. </ListGroupItem>
  13. <ListGroupItem>
  14. <ListGroupItemHeading>List group item heading</ListGroupItemHeading>
  15. <ListGroupItemText>
  16. Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.
  17. </ListGroupItemText>
  18. </ListGroupItem>
  19. <ListGroupItem>
  20. <ListGroupItemHeading>List group item heading</ListGroupItemHeading>
  21. <ListGroupItemText>
  22. Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.
  23. </ListGroupItemText>
  24. </ListGroupItem>
  25. </ListGroup>
  26. );
  27. }
  28. }

FlushList Group - 图7

  1. import React from 'react';
  2. import { ListGroup, ListGroupItem } from 'reactstrap';
  3. export default class Example extends React.Component {
  4. render() {
  5. return (
  6. <ListGroup flush>
  7. <ListGroupItem disabled tag="a" href="#">Cras justo odio</ListGroupItem>
  8. <ListGroupItem tag="a" href="#">Dapibus ac facilisis in</ListGroupItem>
  9. <ListGroupItem tag="a" href="#">Morbi leo risus</ListGroupItem>
  10. <ListGroupItem tag="a" href="#">Porta ac consectetur ac</ListGroupItem>
  11. <ListGroupItem tag="a" href="#">Vestibulum at eros</ListGroupItem>
  12. </ListGroup>
  13. );
  14. }
  15. }