Properties

  1. // Pass in a Component to override default element
  2. tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
  3. size: PropTypes.string,
  4. bordered: PropTypes.bool,
  5. borderless: PropTypes.bool,
  6. striped: PropTypes.bool,
  7. dark: PropTypes.bool,
  8. hover: PropTypes.bool,
  9. responsive: PropTypes.bool,
  10. // Custom ref handler that will be assigned to the "ref" of the inner <table> element
  11. innerRef: PropTypes.oneOfType([
  12. PropTypes.func,
  13. PropTypes.string,
  14. PropTypes.object
  15. ])
  16. };

  1. import React from 'react';
  2. import { Table } from 'reactstrap';
  3. export default class Example extends React.Component {
  4. render() {
  5. return (
  6. <Table dark>
  7. <thead>
  8. <tr>
  9. <th>#</th>
  10. <th>First Name</th>
  11. <th>Last Name</th>
  12. <th>Username</th>
  13. </tr>
  14. </thead>
  15. <tbody>
  16. <tr>
  17. <th scope="row">1</th>
  18. <td>Mark</td>
  19. <td>Otto</td>
  20. <td>@mdo</td>
  21. </tr>
  22. <tr>
  23. <th scope="row">2</th>
  24. <td>Jacob</td>
  25. <td>Thornton</td>
  26. <td>@fat</td>
  27. </tr>
  28. <tr>
  29. <th scope="row">3</th>
  30. <td>Larry</td>
  31. <td>the Bird</td>
  32. <td>@twitter</td>
  33. </tr>
  34. </tbody>
  35. </Table>
  36. );
  37. }
  38. }

Striped rows

Tables - 图1

  1. import React from 'react';
  2. import { Table } from 'reactstrap';
  3. export default class Example extends React.Component {
  4. render() {
  5. return (
  6. <Table bordered>
  7. <thead>
  8. <tr>
  9. <th>#</th>
  10. <th>First Name</th>
  11. <th>Last Name</th>
  12. </tr>
  13. </thead>
  14. <tbody>
  15. <tr>
  16. <th scope="row">1</th>
  17. <td>Otto</td>
  18. <td>@mdo</td>
  19. </tr>
  20. <tr>
  21. <th scope="row">2</th>
  22. <td>Jacob</td>
  23. <td>Thornton</td>
  24. <td>@fat</td>
  25. </tr>
  26. <tr>
  27. <th scope="row">3</th>
  28. <td>Larry</td>
  29. <td>the Bird</td>
  30. <td>@twitter</td>
  31. </tr>
  32. </tbody>
  33. </Table>
  34. );
  35. }
  36. }

Borderless table

  1. import React from 'react';
  2. import { Table } from 'reactstrap';
  3. export default class Example extends React.Component {
  4. render() {
  5. return (
  6. <Table borderless>
  7. <thead>
  8. <tr>
  9. <th>#</th>
  10. <th>First Name</th>
  11. <th>Last Name</th>
  12. <th>Username</th>
  13. </tr>
  14. </thead>
  15. <tbody>
  16. <tr>
  17. <th scope="row">1</th>
  18. <td>Mark</td>
  19. <td>Otto</td>
  20. <td>@mdo</td>
  21. </tr>
  22. <tr>
  23. <th scope="row">2</th>
  24. <td>Jacob</td>
  25. <td>Thornton</td>
  26. <td>@fat</td>
  27. </tr>
  28. <tr>
  29. <th scope="row">3</th>
  30. <td>Larry</td>
  31. <td>the Bird</td>
  32. <td>@twitter</td>
  33. </tr>
  34. </tbody>
  35. </Table>
  36. );
  37. }
  38. }

Small table

  1. import React from 'react';
  2. import { Table } from 'reactstrap';
  3. export default class Example extends React.Component {
  4. render() {
  5. return (
  6. <Table size="sm">
  7. <thead>
  8. <tr>
  9. <th>#</th>
  10. <th>First Name</th>
  11. <th>Username</th>
  12. </tr>
  13. <tbody>
  14. <tr>
  15. <th scope="row">1</th>
  16. <td>Mark</td>
  17. <td>Otto</td>
  18. <td>@mdo</td>
  19. </tr>
  20. <tr>
  21. <th scope="row">2</th>
  22. <td>Jacob</td>
  23. <td>Thornton</td>
  24. <td>@fat</td>
  25. </tr>
  26. <tr>
  27. <th scope="row">3</th>
  28. <td>Larry</td>
  29. <td>the Bird</td>
  30. <td>@twitter</td>
  31. </tr>
  32. </tbody>
  33. </Table>
  34. );
  35. }
  36. }

Tables - 图2

  1. import React from 'react';
  2. import { Table } from 'reactstrap';
  3. export default class Example extends React.Component {
  4. render() {
  5. return (
  6. <Table responsive>
  7. <thead>
  8. <tr>
  9. <th>#</th>
  10. <th>Table heading</th>
  11. <th>Table heading</th>
  12. <th>Table heading</th>
  13. <th>Table heading</th>
  14. <th>Table heading</th>
  15. <th>Table heading</th>
  16. </tr>
  17. </thead>
  18. <tbody>
  19. <tr>
  20. <th scope="row">1</th>
  21. <td>Table cell</td>
  22. <td>Table cell</td>
  23. <td>Table cell</td>
  24. <td>Table cell</td>
  25. <td>Table cell</td>
  26. <td>Table cell</td>
  27. </tr>
  28. <tr>
  29. <th scope="row">2</th>
  30. <td>Table cell</td>
  31. <td>Table cell</td>
  32. <td>Table cell</td>
  33. <td>Table cell</td>
  34. <td>Table cell</td>
  35. <td>Table cell</td>
  36. </tr>
  37. <tr>
  38. <th scope="row">3</th>
  39. <td>Table cell</td>
  40. <td>Table cell</td>
  41. <td>Table cell</td>
  42. <td>Table cell</td>
  43. <td>Table cell</td>
  44. <td>Table cell</td>
  45. </tr>
  46. </tbody>
  47. </Table>
  48. );
  49. }