Card


Card - 图1

  1. import React from 'react';
  2. import { Card, CardImg, CardText, CardBody,
  3. CardTitle, CardSubtitle, Button } from 'reactstrap';
  4. const Example = (props) => {
  5. return (
  6. <div>
  7. <Card>
  8. <CardImg top width="100%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=318%C3%97180&w=318&h=180" alt="Card image cap" />
  9. <CardBody>
  10. <CardTitle>Card title</CardTitle>
  11. <CardSubtitle>Card subtitle</CardSubtitle>
  12. <CardText>Some quick example text to build on the card title and make up the bulk of the card's content.</CardText>
  13. <Button>Button</Button>
  14. </CardBody>
  15. </Card>
  16. </div>
  17. );
  18. };
  19. export default Example;

Properties

  1. Card.propTypes = {
  2. // Pass in a Component to override default element
  3. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
  4. inverse: PropTypes.bool,
  5. color: PropTypes.string,
  6. body: PropTypes.bool,
  7. className: PropTypes.string
  8. };
  9. CardBody.propTypes = {
  10. // Pass in a Component to override default element
  11. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
  12. className: PropTypes.string
  13. };
  14. CardColumns.propTypes = {
  15. // Pass in a Component to override default element
  16. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
  17. className: PropTypes.string
  18. };
  19. CardDeck.propTypes = {
  20. // Pass in a Component to override default element
  21. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
  22. className: PropTypes.string
  23. };
  24. CardFooter.propTypes = {
  25. // Pass in a Component to override default element
  26. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
  27. className: PropTypes.string
  28. };
  29. CardGroup.propTypes = {
  30. // Pass in a Component to override default element
  31. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
  32. className: PropTypes.string
  33. };
  34. CardHeader.propTypes = {
  35. // Pass in a Component to override default element
  36. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
  37. className: PropTypes.string
  38. };
  39. CardImg.propTypes = {
  40. // Pass in a Component to override default element
  41. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
  42. className: PropTypes.string,
  43. // Use top or bottom to position image via "card-img-top" or "card-img-bottom"
  44. top: PropTypes.bool,
  45. bottom: PropTypes.bool
  46. };
  47. CardImgOverlay.propTypes = {
  48. // Pass in a Component to override default element
  49. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
  50. className: PropTypes.string
  51. };
  52. CardLink.propTypes = {
  53. // Pass in a Component to override default element
  54. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
  55. className: PropTypes.string,
  56. // ref will only get you a reference to the CardLink component, use innerRef to get a reference to the DOM element (for things like focus management).
  57. innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
  58. };
  59. CardSubtitle.propTypes = {
  60. // Pass in a Component to override default element
  61. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
  62. className: PropTypes.string
  63. };
  64. CardText.propTypes = {
  65. // Pass in a Component to override default element
  66. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
  67. className: PropTypes.string
  68. };
  69. CardTitle.propTypes = {
  70. // Pass in a Component to override default element
  71. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
  72. className: PropTypes.string
  73. };

Content Types

Card - 图2

  1. import React from 'react';
  2. import { Card, CardImg, CardText, CardBody, CardLink,
  3. CardTitle, CardSubtitle } from 'reactstrap';
  4. const Example = (props) => {
  5. return (
  6. <div>
  7. <Card>
  8. <CardBody>
  9. <CardTitle>Card title</CardTitle>
  10. <CardSubtitle>Card subtitle</CardSubtitle>
  11. </CardBody>
  12. <img width="100%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=318%C3%97180&w=318&h=180" alt="Card image cap" />
  13. <CardBody>
  14. <CardText>Some quick example text to build on the card title and make up the bulk of the card's content.</CardText>
  15. <CardLink href="#">Card Link</CardLink>
  16. <CardLink href="#">Another Link</CardLink>
  17. </CardBody>
  18. </Card>
  19. </div>
  20. );
  21. };
  22. export default Example;

Sizing

Card - 图3

  1. import React from 'react';
  2. import { Card, Button, CardTitle, CardText, Row, Col } from 'reactstrap';
  3. const Example = (props) => {
  4. return (
  5. <Row>
  6. <Col sm="6">
  7. <Card body>
  8. <CardTitle>Special Title Treatment</CardTitle>
  9. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  10. <Button>Go somewhere</Button>
  11. </Card>
  12. </Col>
  13. <Col sm="6">
  14. <Card body>
  15. <CardTitle>Special Title Treatment</CardTitle>
  16. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  17. <Button>Go somewhere</Button>
  18. </Card>
  19. </Col>
  20. </Row>
  21. );
  22. };
  23. export default Example;

Text alignment

Card - 图4

  1. import React from 'react';
  2. import { Card, Button, CardTitle, CardText } from 'reactstrap';
  3. const Example = (props) => {
  4. return (
  5. <div>
  6. <Card body>
  7. <CardTitle>Special Title Treatment</CardTitle>
  8. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  9. <Button>Go somewhere</Button>
  10. </Card>
  11. <Card body className="text-center">
  12. <CardTitle>Special Title Treatment</CardTitle>
  13. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  14. <Button>Go somewhere</Button>
  15. </Card>
  16. <Card body className="text-right">
  17. <CardTitle>Special Title Treatment</CardTitle>
  18. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  19. <Button>Go somewhere</Button>
  20. </Card>
  21. </div>
  22. );
  23. };
  24. export default Example;

Card - 图5

  1. import React from 'react';
  2. import { Card, Button, CardHeader, CardFooter, CardBody,
  3. CardTitle, CardText } from 'reactstrap';
  4. const Example = (props) => {
  5. return (
  6. <div>
  7. <Card>
  8. <CardHeader>Header</CardHeader>
  9. <CardBody>
  10. <CardTitle>Special Title Treatment</CardTitle>
  11. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  12. <Button>Go somewhere</Button>
  13. </CardBody>
  14. <CardFooter>Footer</CardFooter>
  15. </Card>
  16. <Card>
  17. <CardHeader tag="h3">Featured</CardHeader>
  18. <CardBody>
  19. <CardTitle>Special Title Treatment</CardTitle>
  20. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  21. <Button>Go somewhere</Button>
  22. </CardBody>
  23. <CardFooter className="text-muted">Footer</CardFooter>
  24. </Card>
  25. </div>
  26. );
  27. };
  28. export default Example;

Image caps

Card - 图6

  1. import React from 'react';
  2. import { Card, CardBody, Button, CardTitle, CardText, CardImg } from 'reactstrap';
  3. const Example = (props) => {
  4. return (
  5. <div>
  6. <Card>
  7. <CardImg top width="100%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=318%C3%97180&w=318&h=180" alt="Card image cap" />
  8. <CardBody>
  9. <CardTitle>Card Title</CardTitle>
  10. <CardText>This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</CardText>
  11. <CardText>
  12. <small className="text-muted">Last updated 3 mins ago</small>
  13. </CardText>
  14. </CardBody>
  15. </Card>
  16. <Card>
  17. <CardBody>
  18. <CardTitle>Card Title</CardTitle>
  19. <CardText>This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</CardText>
  20. <CardText>
  21. <small className="text-muted">Last updated 3 mins ago</small>
  22. </CardText>
  23. </CardBody>
  24. <CardImg bottom width="100%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=318%C3%97180&w=318&h=180" alt="Card image cap" />
  25. </Card>
  26. </div>
  27. );
  28. };
  29. export default Example;

Image overlays

Card - 图7

  1. import React from 'react';
  2. import { Card, CardTitle, CardText, CardImg, CardImgOverlay } from 'reactstrap';
  3. const Example = (props) => {
  4. return (
  5. <div>
  6. <Card inverse>
  7. <CardImg width="100%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=318%C3%97270&w=318&h=270&bg=333333&txtclr=666666" alt="Card image cap" />
  8. <CardImgOverlay>
  9. <CardTitle>Card Title</CardTitle>
  10. <CardText>This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</CardText>
  11. <CardText>
  12. <small className="text-muted">Last updated 3 mins ago</small>
  13. </CardText>
  14. </CardImgOverlay>
  15. </Card>
  16. </div>
  17. );
  18. };
  19. export default Example;

Background variants

Card - 图8

  1. import React from 'react';
  2. import { Card, Button, CardTitle, CardText } from 'reactstrap';
  3. const Example = (props) => {
  4. return (
  5. <div>
  6. <Card body inverse style={{ backgroundColor: '#333', borderColor: '#333' }}>
  7. <CardTitle>Special Title Treatment</CardTitle>
  8. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  9. <Button>Button</Button>
  10. </Card>
  11. <Card body inverse color="primary">
  12. <CardTitle>Special Title Treatment</CardTitle>
  13. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  14. <Button color="secondary">Button</Button>
  15. </Card>
  16. <Card body inverse color="success">
  17. <CardTitle>Special Title Treatment</CardTitle>
  18. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  19. <Button color="secondary">Button</Button>
  20. </Card>
  21. <Card body inverse color="info">
  22. <CardTitle>Special Title Treatment</CardTitle>
  23. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  24. <Button color="secondary">Button</Button>
  25. </Card>
  26. <Card body inverse color="warning">
  27. <CardTitle>Special Title Treatment</CardTitle>
  28. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  29. <Button color="secondary">Button</Button>
  30. </Card>
  31. <Card body inverse color="danger">
  32. <CardTitle>Special Title Treatment</CardTitle>
  33. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  34. <Button color="secondary">Button</Button>
  35. </Card>
  36. </div>
  37. );
  38. };
  39. export default Example;

Outline variants

Card - 图9

  1. import React from 'react';
  2. import { Card, Button, CardTitle, CardText } from 'reactstrap';
  3. const Example = (props) => {
  4. return (
  5. <div>
  6. <Card body outline color="secondary">
  7. <CardTitle>Special Title Treatment</CardTitle>
  8. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  9. <Button>Button</Button>
  10. </Card>
  11. <Card body outline color="primary">
  12. <CardTitle>Special Title Treatment</CardTitle>
  13. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  14. <Button color="secondary">Button</Button>
  15. </Card>
  16. <Card body outline color="success">
  17. <CardTitle>Special Title Treatment</CardTitle>
  18. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  19. <Button color="secondary">Button</Button>
  20. </Card>
  21. <Card body outline color="info">
  22. <CardTitle>Special Title Treatment</CardTitle>
  23. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  24. <Button color="secondary">Button</Button>
  25. </Card>
  26. <Card body outline color="warning">
  27. <CardTitle>Special Title Treatment</CardTitle>
  28. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  29. <Button color="secondary">Button</Button>
  30. </Card>
  31. <Card body outline color="danger">
  32. <CardTitle>Special Title Treatment</CardTitle>
  33. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  34. <Button color="secondary">Button</Button>
  35. </Card>
  36. </div>
  37. );
  38. };
  39. export default Example;

Groups

Card - 图10

  1. import React from 'react';
  2. import { Card, Button, CardImg, CardTitle, CardText, CardGroup,
  3. CardSubtitle, CardBody } from 'reactstrap';
  4. const Example = (props) => {
  5. return (
  6. <CardGroup>
  7. <Card>
  8. <CardImg top width="100%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=256%C3%97180&w=256&h=180" alt="Card image cap" />
  9. <CardBody>
  10. <CardTitle>Card title</CardTitle>
  11. <CardSubtitle>Card subtitle</CardSubtitle>
  12. <CardText>This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</CardText>
  13. <Button>Button</Button>
  14. </CardBody>
  15. </Card>
  16. <Card>
  17. <CardImg top width="100%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=256%C3%97180&w=256&h=180" alt="Card image cap" />
  18. <CardBody>
  19. <CardTitle>Card title</CardTitle>
  20. <CardSubtitle>Card subtitle</CardSubtitle>
  21. <CardText>This card has supporting text below as a natural lead-in to additional content.</CardText>
  22. <Button>Button</Button>
  23. </CardBody>
  24. </Card>
  25. <Card>
  26. <CardImg top width="100%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=256%C3%97180&w=256&h=180" alt="Card image cap" />
  27. <CardBody>
  28. <CardTitle>Card title</CardTitle>
  29. <CardSubtitle>Card subtitle</CardSubtitle>
  30. <CardText>This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</CardText>
  31. <Button>Button</Button>
  32. </CardBody>
  33. </Card>
  34. </CardGroup>
  35. );
  36. };
  37. export default Example;

Decks

Card - 图11

  1. import React from 'react';
  2. import { Card, Button, CardImg, CardTitle, CardText, CardDeck,
  3. CardSubtitle, CardBody } from 'reactstrap';
  4. const Example = (props) => {
  5. return (
  6. <CardDeck>
  7. <Card>
  8. <CardImg top width="100%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=256%C3%97180&w=256&h=180" alt="Card image cap" />
  9. <CardBody>
  10. <CardTitle>Card title</CardTitle>
  11. <CardSubtitle>Card subtitle</CardSubtitle>
  12. <CardText>This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</CardText>
  13. <Button>Button</Button>
  14. </CardBody>
  15. </Card>
  16. <Card>
  17. <CardImg top width="100%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=256%C3%97180&w=256&h=180" alt="Card image cap" />
  18. <CardBody>
  19. <CardTitle>Card title</CardTitle>
  20. <CardSubtitle>Card subtitle</CardSubtitle>
  21. <CardText>This card has supporting text below as a natural lead-in to additional content.</CardText>
  22. <Button>Button</Button>
  23. </CardBody>
  24. </Card>
  25. <Card>
  26. <CardImg top width="100%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=256%C3%97180&w=256&h=180" alt="Card image cap" />
  27. <CardBody>
  28. <CardTitle>Card title</CardTitle>
  29. <CardSubtitle>Card subtitle</CardSubtitle>
  30. <CardText>This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</CardText>
  31. <Button>Button</Button>
  32. </CardBody>
  33. </Card>
  34. </CardDeck>
  35. );
  36. };
  37. export default Example;

Columns

Card - 图12

  1. import React from 'react';
  2. import { Card, Button, CardImg, CardTitle, CardText, CardColumns,
  3. CardSubtitle, CardBody } from 'reactstrap';
  4. const Example = (props) => {
  5. return (
  6. <CardColumns>
  7. <Card>
  8. <CardImg top width="100%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=256%C3%97180&w=256&h=180" alt="Card image cap" />
  9. <CardBody>
  10. <CardTitle>Card title</CardTitle>
  11. <CardSubtitle>Card subtitle</CardSubtitle>
  12. <CardText>This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</CardText>
  13. <Button>Button</Button>
  14. </CardBody>
  15. </Card>
  16. <Card>
  17. <CardImg top width="100%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=256%C3%97180&w=256&h=180" alt="Card image cap" />
  18. </Card>
  19. <Card>
  20. <CardBody>
  21. <CardTitle>Card title</CardTitle>
  22. <CardSubtitle>Card subtitle</CardSubtitle>
  23. <CardText>This card has supporting text below as a natural lead-in to additional content.</CardText>
  24. <Button>Button</Button>
  25. </CardBody>
  26. </Card>
  27. <Card body inverse style={{ backgroundColor: '#333', borderColor: '#333' }}>
  28. <CardTitle>Special Title Treatment</CardTitle>
  29. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  30. <Button>Button</Button>
  31. </Card>
  32. <Card>
  33. <CardImg top width="100%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=256%C3%97180&w=256&h=180" alt="Card image cap" />
  34. <CardBody>
  35. <CardTitle>Card title</CardTitle>
  36. <CardSubtitle>Card subtitle</CardSubtitle>
  37. <CardText>This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</CardText>
  38. <Button>Button</Button>
  39. </CardBody>
  40. </Card>
  41. <Card body inverse color="primary">
  42. <CardTitle>Special Title Treatment</CardTitle>
  43. <CardText>With supporting text below as a natural lead-in to additional content.</CardText>
  44. <Button color="secondary">Button</Button>
  45. </Card>
  46. </CardColumns>
  47. );
  48. };
  49. export default Example;