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';
export default class Example extends React.Component {
render() {
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>
);
}
}
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
};
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';
export default class Example extends React.Component {
render() {
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>
);
}
}
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';
export default class Example extends React.Component {
render() {
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>
);
}
}
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';
export default class Example extends React.Component {
render() {
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>
);
}
}
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';
export default class Example extends React.Component {
render() {
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>
);
}
}
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';
export default class Example extends React.Component {
render() {
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>
);
}
}
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';
export default class Example extends React.Component {
render() {
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>
);
}
}
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';
export default class Example extends React.Component {
render() {
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>
);
}
}