Tables
# | First Name | Last Name | Username |
---|
1 | Mark | Otto | @mdo |
---|
2 | Jacob | Thornton | @fat |
---|
3 | Larry | the Bird | @twitter |
---|
import React from 'react';
import { Table } from 'reactstrap';
const Example = (props) => {
return (
<Table>
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</Table>
);
}
export default Example;
Properties
Table.propTypes = {
// Pass in a Component to override default element
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
size: PropTypes.string,
bordered: PropTypes.bool,
borderless: PropTypes.bool,
striped: PropTypes.bool,
dark: PropTypes.bool,
hover: PropTypes.bool,
responsive: PropTypes.bool,
// Custom ref handler that will be assigned to the "ref" of the inner <table> element
innerRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.string,
PropTypes.object
])
};
Dark table
# | First Name | Last Name | Username |
---|
1 | Mark | Otto | @mdo |
---|
2 | Jacob | Thornton | @fat |
---|
3 | Larry | the Bird | @twitter |
---|
import React from 'react';
import { Table } from 'reactstrap';
const Example = (props) => {
return (
<Table dark>
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</Table>
);
}
export default Example;
Striped rows
# | First Name | Last Name | Username |
---|
1 | Mark | Otto | @mdo |
---|
2 | Jacob | Thornton | @fat |
---|
3 | Larry | the Bird | @twitter |
---|
import React from 'react';
import { Table } from 'reactstrap';
const Example = (props) => {
return (
<Table striped>
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</Table>
);
}
export default Example;
Bordered table
# | First Name | Last Name | Username |
---|
1 | Mark | Otto | @mdo |
---|
2 | Jacob | Thornton | @fat |
---|
3 | Larry | the Bird | @twitter |
---|
import React from 'react';
import { Table } from 'reactstrap';
const Example = (props) => {
return (
<Table bordered>
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</Table>
);
}
export default Example;
Borderless table
# | First Name | Last Name | Username |
---|
1 | Mark | Otto | @mdo |
---|
2 | Jacob | Thornton | @fat |
---|
3 | Larry | the Bird | @twitter |
---|
import React from 'react';
import { Table } from 'reactstrap';
const Example = (props) => {
return (
<Table borderless>
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</Table>
);
}
export default Example;
Hoverable rows
# | First Name | Last Name | Username |
---|
1 | Mark | Otto | @mdo |
---|
2 | Jacob | Thornton | @fat |
---|
3 | Larry | the Bird | @twitter |
---|
import React from 'react';
import { Table } from 'reactstrap';
const Example = (props) => {
return (
<Table hover>
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</Table>
);
}
export default Example;
Small table
# | First Name | Last Name | Username |
---|
1 | Mark | Otto | @mdo |
---|
2 | Jacob | Thornton | @fat |
---|
3 | Larry | the Bird | @twitter |
---|
import React from 'react';
import { Table } from 'reactstrap';
const Example = (props) => {
return (
<Table size="sm">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</Table>
);
}
export default Example;
Responsive table
# | Table heading | Table heading | Table heading | Table heading | Table heading | Table heading |
---|
1 | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
---|
2 | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
---|
3 | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
---|
import React from 'react';
import { Table } from 'reactstrap';
const Example = (props) => {
return (
<Table responsive>
<thead>
<tr>
<th>#</th>
<th>Table heading</th>
<th>Table heading</th>
<th>Table heading</th>
<th>Table heading</th>
<th>Table heading</th>
<th>Table heading</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
</tr>
</tbody>
</Table>
);
}
export default Example;