Vue Bootstrap Tables

Vue Tables - Bootstrap 4 & Material Design

Tables let you aggregate a huge amount of data and present it in the clear and orderly way. Vue Bootstrap tables provide additional benefits like responsiveness and the possibility to manipulate the styles of the tables. You can enhance your tables by adding buttons, checkboxes, panels, and many other additional elements. You can also use an advanced datatables options like sort, search or pagination.


If you want to use basic bootstrap tables have a look at the documentation below.

For more advanced options go to the specific documentation pages listed below:


Basic table

Using the most basic table markup, here’s how .table-based tables look in Bootstrap. All table styles are inherited in Bootstrap 4, meaning any nested tables will be styled in the same manner as the parent.

# First Last Handle
1 Mark Otto @mdo
2 Jacob Thornton @fat
3 Larry the Bird @twitter

        <template>
          <div>
            <mdb-tbl>
              <mdb-tbl-head>
                <tr>
                  <th>#</th>
                  <th>First</th>
                  <th>Last</th>
                  <th>Handle</th>
                </tr>
              </mdb-tbl-head>
              <mdb-tbl-body>
                <tr>
                  <th>1</th>
                  <td>Mark</td>
                  <td>Otto</td>
                  <td>@mdo</td>
                </tr>
                <tr>
                  <th>2</th>
                  <td>Jacob</td>
                  <td>Thornton</td>
                  <td>@fat</td>
                </tr>
                <tr>
                  <th>3</th>
                  <td>Larry</td>
                  <td>the Bird</td>
                  <td>@twitter</td>
                </tr>
              </mdb-tbl-body>
            </mdb-tbl>
          </div>
        </template>
      

        <script>
          import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue';
          export default {
            name: 'TablePage',
            components: {
              mdbTbl,
              mdbTblHead,
              mdbTblBody
            }
          }
        </script>
      

Table head options

To change a background-color of <mdb-tbl-head> (or any other element) use our color classes names in property color. . If you are going to use a dark background you should also consider white text (to provide a proper contrast) by adding textWhite property.

# First Last Handle
1 Mark Otto @mdo
2 Jacob Thornton @fat
3 Larry the Bird @twitter
# First Last Handle
1 Mark Otto @mdo
2 Jacob Thornton @fat
3 Larry the Bird @twitter

        <template>
            <div>
              <mdb-tbl>
                <mdb-tbl-head color="black" textWhite>
                  <tr>
                    <th>#</th>
                    <th>First</th>
                    <th>Last</th>
                    <th>Handle</th>
                  </tr>
                </mdb-tbl-head>
                <mdb-tbl-body>
                  <tr>
                    <th>1</th>
                    <td>Mark</td>
                    <td>Otto</td>
                    <td>@mdo</td>
                  </tr>
                  <tr>
                    <th>2</th>
                    <td>Jacob</td>
                    <td>Thornton</td>
                    <td>@fat</td>
                  </tr>
                  <tr>
                    <th>3</th>
                    <td>Larry</td>
                    <td>the Bird</td>
                    <td>@twitter</td>
                  </tr>
                </mdb-tbl-body>
              </mdb-tbl>

              <mdb-tbl>
                <mdb-tbl-head color="grey">
                  <tr>
                    <th>#</th>
                    <th>First</th>
                    <th>Last</th>
                    <th>Handle</th>
                  </tr>
                </mdb-tbl-head>
                <mdb-tbl-body>
                  <tr>
                    <th>1</th>
                    <td>Mark</td>
                    <td>Otto</td>
                    <td>@mdo</td>
                  </tr>
                  <tr>
                    <th>2</th>
                    <td>Jacob</td>
                    <td>Thornton</td>
                    <td>@fat</td>
                  </tr>
                  <tr>
                    <th>3</th>
                    <td>Larry</td>
                    <td>the Bird</td>
                    <td>@twitter</td>
                  </tr>
                </mdb-tbl-body>
              </mdb-tbl>
            </div>
          </template>
      

        <script>
          import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue';
          
          export default {
            name: 'TablePage',
            components: {
              mdbTbl,
              mdbTblHead,
              mdbTblBody
            }
          }
        </script>
      

Striped rows

Use prop striped to add zebra-striping to any table row within the <mdb-tbl-body>.

# First Last Handle
1 Mark Otto @mdo
2 Jacob Thornton @fat
3 Larry the Bird @twitter

        <template>
            <div>
              <mdb-tbl striped>
                <mdb-tbl-head>
                  <tr>
                    <th>#</th>
                    <th>First</th>
                    <th>Last</th>
                    <th>Handle</th>
                  </tr>
                </mdb-tbl-head>
                <mdb-tbl-body>
                  <tr>
                    <th>1</th>
                    <td>Mark</td>
                    <td>Otto</td>
                    <td>@mdo</td>
                  </tr>
                  <tr>
                    <th>2</th>
                    <td>Jacob</td>
                    <td>Thornton</td>
                    <td>@fat</td>
                  </tr>
                  <tr>
                    <th>3</th>
                    <td>Larry</td>
                    <td>the Bird</td>
                    <td>@twitter</td>
                  </tr>
                </mdb-tbl-body>
              </mdb-tbl>
            </div>
          </template>
        

          <script>
            import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue';
            export default {
              name: 'TablePage',
              components: {
                mdbTbl,
                mdbTblHead,
                mTblBody
              }
            }
          </script>
        

Bordered table

Add prop bordered for borders on all sides of the table and cells.

# First Last Handle
1 Mark Otto @mdo
2 Jacob Thornton @fat
3 Larry the Bird @twitter

        <template>
          <div>
            <mdb-tbl bordered>
              <mdb-tbl-head>
                <tr>
                  <th>#</th>
                  <th>First</th>
                  <th>Last</th>
                  <th>Handle</th>
                </tr>
              </mdb-tbl-head>
              <mdb-tbl-body>
                <tr>
                  <th>1</th>
                  <td>Mark</td>
                  <td>Otto</td>
                  <td>@mdo</td>
                </tr>
                <tr>
                  <th>2</th>
                  <td>Jacob</td>
                  <td>Thornton</td>
                  <td>@fat</td>
                </tr>
                <tr>
                  <th>3</th>
                  <td colspan="2">Larry the Bird</td>
                  <td>@twitter</td>
                </tr>
              </mdb-tbl-body>
            </mdb-tbl>
          </div>
        </template>
      

        <script>
          import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue';
          export default {
            name: 'TablePage',
            components: {
              mdbTbl,
              mdbTblHead,
              mdbTblBody
            }
          }
        </script>
      

Borderless table

Add prop borderless for a table without borders.

# First Last Handle
1 Mark Otto @mdo
2 Jacob Thornton @fat
3 Larry the Bird @twitter

        <template>
          <div>
            <mdb-tbl borderless>
              <mdb-tbl-head>
                <tr>
                  <th>#</th>
                  <th>First</th>
                  <th>Last</th>
                  <th>Handle</th>
                </tr>
              </mdb-tbl-head>
              <mdb-tbl-body>
                <tr>
                  <th>1</th>
                  <td>Mark</td>
                  <td>Otto</td>
                  <td>@mdo</td>
                </tr>
                <tr>
                  <th>2</th>
                  <td>Jacob</td>
                  <td>Thornton</td>
                  <td>@fat</td>
                </tr>
                <tr>
                  <th>3</th>
                  <td colspan="2">Larry the Bird</td>
                  <td>@twitter</td>
                </tr>
              </mdb-tbl-body>
            </mdb-tbl>
          </div>
        </template>
      

        <script>
          import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue';
          export default {
            name: 'TablePage',
            components: {
              mdbTbl,
              mdbTblHead,
              mdbTblBody
            }
          }
        </script>
      

Hoverable rows

Add prop hover to enable a hover state on table rows.

# First Last Handle
1 Mark Otto @mdo
2 Jacob Thornton @fat
3 Larry the Bird @twitter

        <template>
          <div>
            <mdb-tbl hover>
              <mdb-tbl-head>
                <tr>
                  <th>#</th>
                  <th>First</th>
                  <th>Last</th>
                  <th>Handle</th>
                </tr>
              </mdb-tbl-head>
              <mdb-tbl-body>
                <tr>
                  <th>1</th>
                  <td>Mark</td>
                  <td>Otto</td>
                  <td>@mdo</td>
                </tr>
                <tr>
                  <th>2</th>
                  <td>Jacob</td>
                  <td>Thornton</td>
                  <td>@fat</td>
                </tr>
                <tr>
                  <th>3</th>
                  <td colspan="2">Larry the Bird</td>
                  <td>@twitter</td>
                </tr>
              </mdb-tbl-body>
            </mdb-tbl>
          </div>
        </template>
      

        <script>
          import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue'; 
          export default {
            name: 'TablePage',
            components: {
              mdbTbl,
              mdbTblHead,
              mdbTblBody
            }
          }
        </script>
      

Small table

Add prop sm to make tables more compact by cutting cell padding in half.

# First Last Handle
1 Mark Otto @mdo
2 Jacob Thornton @fat
3 Larry the Bird @twitter

        <template>
          <div>
            <mdb-tbl sm>
              <mdb-tbl-head>
                <tr>
                  <th>#</th>
                  <th>First</th>
                  <th>Last</th>
                  <th>Handle</th>
                </tr>
              </mdb-tbl-head>
              <mdb-tbl-body>
                <tr>
                  <th>1</th>
                  <td>Mark</td>
                  <td>Otto</td>
                  <td>@mdo</td>
                </tr>
                <tr>
                  <th>2</th>
                  <td>Jacob</td>
                  <td>Thornton</td>
                  <td>@fat</td>
                </tr>
                <tr>
                  <th>3</th>
                  <td colspan="2">Larry the Bird</td>
                  <td>@twitter</td>
                </tr>
              </mdb-tbl-body>
            </mdb-tbl>
          </div>
        </template>
      

        <script>
          import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue';
          export default {
            name: 'TablePage',
            components: {
              mdbTbl,
              mdbTblHead,
              mdbTblBody
            }
          }
        </script>
      

Captions

caption functions like a heading for a table. It helps users with screen readers to find a table and understand what it’s about and decide if they want to read it.

List of users
# First Last Handle
1 Mark Otto @mdo
2 Jacob Thornton @fat
3 Larry the Bird @twitter

        <template>
          <div>
            <mdb-tbl>
              <caption>List of users</caption>
              <mdb-tbl-head>
                <tr>
                  <th>#</th>
                  <th>First</th>
                  <th>Last</th>
                  <th>Handle</th>
                </tr>
              </mdb-tbl-head>
              <mdb-tbl-body>
                <tr>
                  <th>1</th>
                  <td>Mark</td>
                  <td>Otto</td>
                  <td>@mdo</td>
                </tr>
                <tr>
                  <th>2</th>
                  <td>Jacob</td>
                  <td>Thornton</td>
                  <td>@fat</td>
                </tr>
                <tr>
                  <th>3</th>
                  <td>Larry</td>
                  <td>the Bird</td>
                  <td>@twitter</td>
                </tr>
              </mdb-tbl-body>
            </mdb-tbl>
          </div>
        </template>
      

        <script>
          import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue';
          export default {
            name: 'TablePage',
            components: {
              mdbTbl,
              mdbTblHead,
              mdbTblBody
            }
          }
        </script>
      

Responsive table

Create responsive table by adding prop responsive to make them scroll horizontally on small devices (under 768px). When viewing on anything larger than 768px wide, you will not see any difference in these tables.

Vertical clipping/truncation

Responsive tables make use of overflow-y: hidden, which clips off any content that goes beyond the bottom or top edges of the table. In particular, this can clip off dropdown menus and other third-party widgets.

Note: For more advanced options of responsive tables have a look at Responsive Tables documentation .

# Heading Heading Heading Heading Heading Heading Heading Heading Heading
1 Cell Cell Cell Cell Cell Cell Cell Cell Cell
2 Cell Cell Cell Cell Cell Cell Cell Cell Cell
3 Cell Cell Cell Cell Cell Cell Cell Cell Cell

        <template>
          <div>
            <mdb-tbl responsive>
              <mdb-tbl-head>
                <tr>
                  <th>#</th>
                  <th>Heading</th>
                  <th>Heading</th>
                  <th>Heading</th>
                  <th>Heading</th>
                  <th>Heading</th>
                  <th>Heading</th>
                  <th>Heading</th>
                  <th>Heading</th>
                  <th>Heading</th>
                </tr>
              </mdb-tbl-head>
              <mdb-tbl-body>
                <tr>
                  <th scope="row">1</th>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                </tr>
                <tr>
                  <th scope="row">2</th>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                </tr>
                <tr>
                  <th scope="row">3</th>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                  <td>Cell</td>
                </tr>
              </mdb-tbl-body>
            </mdb-tbl>
          </div>
        </template>
      

        <script>
          import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue';
          export default {
            name: 'TablePage',
            components: {
              mdbTbl,
              mdbTblHead,
              mdbTblBody
            }
          }
        </script>
      

Fixed header

# thead col 1 thead col 2 thead col 3
1 tbody col 1 tbody col 2 tbody col 3
2 tbody col 1 tbody col 2 tbody col 3
3 tbody col 1 tbody col 2 tbody col 3
4 tbody col 1 tbody col 2 tbody col 3
5 tbody col 1 tbody col 2 tbody col 3
6 tbody col 1 tbody col 2 tbody col 3
7 tbody col 1 tbody col 2 tbody col 3
8 tbody col 1 tbody col 2 tbody col 3
9 tbody col 1 tbody col 2 tbody col 3

        <template>
          <mdb-tbl class="fixed-header">
            <mdb-tbl-head>
              <tr>
                <th>#</th>
                <th>thead col 1</th>
                <th>thead col 2</th>
                <th>thead col 3</th>
              </tr>
            </mdb-tbl-head>
            <mdb-tbl-body>
              <tr scope="row">
                <td>1</td>
                <td>tbody col 1</td>
                <td>tbody col 2</td>
                <td>tbody col 3</td>
              </tr>
              <tr scope="row">
                <td>2</td>
                <td>tbody col 1</td>
                <td>tbody col 2</td>
                <td>tbody col 3</td>
              </tr>
              <tr scope="row">
                <td>3</td>
                <td>tbody col 1</td>
                <td>tbody col 2</td>
                <td>tbody col 3</td>
              </tr>
              <tr scope="row">
                <td>3</td>
                <td>tbody col 1</td>
                <td>tbody col 2</td>
                <td>tbody col 3</td>
              </tr>
              <tr scope="row">
                <td>3</td>
                <td>tbody col 1</td>
                <td>tbody col 2</td>
                <td>tbody col 3</td>
              </tr>
              <tr scope="row">
                <td>3</td>
                <td>tbody col 1</td>
                <td>tbody col 2</td>
                <td>tbody col 3</td>
              </tr>
              <tr scope="row">
                <td>3</td>
                <td>tbody col 1</td>
                <td>tbody col 2</td>
                <td>tbody col 3</td>
              </tr>
              <tr scope="row">
                <td>3</td>
                <td>tbody col 1</td>
                <td>tbody col 2</td>
                <td>tbody col 3</td>
              </tr>
              <tr scope="row">
                <td>3</td>
                <td>tbody col 1</td>
                <td>tbody col 2</td>
                <td>tbody col 3</td>
              </tr>
              <tr scope="row">
                <td>3</td>
                <td>tbody col 1</td>
                <td>tbody col 2</td>
                <td>tbody col 3</td>
              </tr>
            </mdb-tbl-body>
          </mdb-tbl>
        </template>
      

        <script>
          import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue';
          export default {
            name: 'TablePage',
            components: {
              mdbTbl,
              mdbTblHead,
              mdbTblBody
            }
          }
        </script>
      

        <!-- Add "scoped" attribute to limit CSS to this component only -->
        <style scoped>
          .fixed-header .table {
            width: auto;
          }

          .fixed-header thead {
            display: block;
            position: relative;
          }

          .fixed-header tbody {
            display: block;
            height: 200px;
            overflow-y: scroll;
          }
        </style>
      

Fixed column

thead col 1 thead col 2 thead col 3 thead col 4 thead col 5 thead col 6 thead col 7 thead col 8 thead col 9 thead col 10 thead col 11 thead col 12 thead col 13 thead col 14 thead col 15 thead col 16 thead col 17 thead col 18
tbody col 1 tbody col 2 tbody col 3 tbody col 4 tbody col 5 tbody col 6 tbody col 7 tbody col 8 tbody col 9 tbody col 10 tbody col 11 tbody col 12 tbody col 13 tbody col 14 tbody col 15 tbody col 16 tbody col 17 tbody col 18
tbody col 1 tbody col 2 tbody col 3 tbody col 4 tbody col 5 tbody col 6 tbody col 7 tbody col 8 tbody col 9 tbody col 10 tbody col 11 tbody col 12 tbody col 13 tbody col 14 tbody col 15 tbody col 16 tbody col 17 tbody col 18
tbody col 1 tbody col 2 tbody col 3 tbody col 4 tbody col 5 tbody col 6 tbody col 7 tbody col 8 tbody col 9 tbody col 10 tbody col 11 tbody col 12 tbody col 13 tbody col 14 tbody col 15 tbody col 16 tbody col 17 tbody col 18

        <template>
          <mdb-tbl class="fixed-column">
            <mdb-tbl-head>
              <tr>
                <th>thead col 1</th>
                <th>thead col 2</th>
                <th>thead col 3</th>
                <th>thead col 4</th>
                <th>thead col 5</th>
                <th>thead col 6</th>
                <th>thead col 7</th>
                <th>thead col 8</th>
                <th>thead col 9</th>
                <th>thead col 10</th>
                <th>thead col 11</th>
                <th>thead col 12</th>
                <th>thead col 13</th>
                <th>thead col 14</th>
                <th>thead col 15</th>
                <th>thead col 16</th>
                <th>thead col 17</th>
                <th>thead col 18</th>
              </tr>
            </mdb-tbl-head>
            <mdb-tbl-body>
              <tr scope="row">
                <td>tbody col 1</td>
                <td>tbody col 2</td>
                <td>tbody col 3</td>
                <td>tbody col 4</td>
                <td>tbody col 5</td>
                <td>tbody col 6</td>
                <td>tbody col 7</td>
                <td>tbody col 8</td>
                <td>tbody col 9</td>
                <td>tbody col 10</td>
                <td>tbody col 11</td>
                <td>tbody col 12</td>
                <td>tbody col 13</td>
                <td>tbody col 14</td>
                <td>tbody col 15</td>
                <td>tbody col 16</td>
                <td>tbody col 17</td>
                <td>tbody col 18</td>
              </tr>
            </mdb-tbl-body>
          </mdb-tbl>
        </template>
      

        <script>
          import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue';
          export default {
            name: 'TablePage',
            components: {
              mdbTbl,
              mdbTblHead,
              mdbTblBody
            }
          }
        </script>
      

        <!-- Add "scoped" attribute to limit CSS to this component only -->
        <style scoped>
          .fixed-column {
            overflow-x: scroll;
            margin-left: 100px;
          }

          .fixed-column th, .fixed-column td {
            white-space: nowrap;
          }

          .fixed-column tr th:first-child, .fixed-column tr td:first-child {
            position: absolute;
            width: 100px;
            top: auto;
            margin-left: -100px;
            margin-top: -1px;
          }
        </style>
      

Advanced table options

For advanced options of the tables have a look at specific documentation pages listed below.

Table sort

This functionality lets you sort the data of the tables according to any specific columns.

Table scroll

If your table is too long or too wide you can limit its size and enable scroll functionality.

Table editable

Table editable allows you to edit existing data within the table and add new data to the table.

Vue Bootstrap Tables - API

This section present detailed information about Tables usage, properties and customization. Dive into API references to find see all available props and methods.


Imports

To start working with Basic Tables you need to import three components.
mdbTbl, mdbTblBody and mdbTblHead extends native HTML tags with MDB's styles and functions.


        import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue';
      

API Reference: Table component

All properties and options refered to mdbTbl component.

Properties

Name Type Default Description Example
striped Boolean false Adds zebra-striping to any table row. <mdb-tbl striped>
bordered Boolean false Adds border on all table's and cell's sides. <mdb-tbl bordered>
borderless Boolean false Disables border on all table's and cell's sides. <mdb-tbl borderless>
hover Boolean false Adds hover state on table rows (rows are marked on light-grey color). <mdb-tbl hover>
small Boolean false Cuts cell's padding by half. <mdb-tbl small>
reponsive Boolean false Makes table scrollable horizontally when screen width is smaller than table content (under 768px).
It make use of overflow-y: hidden which clips off content that goes beyon the bottom or top edge of the table.
<mdb-tbl responsive>
reponsiveSm Boolean false Makes table scrollable horizontally on under 576px wide screens. <mdb-tbl responsiveSm>
reponsiveMd Boolean false Makes table scrollable horizontally on under 768px wide screens. <mdb-tbl responsiveMd>
reponsiveLg Boolean false Makes table scrollable horizontally on under 992px wide screens. <mdb-tbl responsiveLg>
reponsiveXl Boolean false Makes table scrollable horizontally on under 1200px wide screens. <mdb-tbl responsiveXl>
scrollY Boolean false Allows table to be scrolled vertically if it's content is higher than 200px. Combine it with maxHeight to manipulate table's height. <mdb-tbl scrollY>
maxHeight String 200px Sets table's maxHeight. You can use px, vh or whatever fits to your needs. <mdb-tbl maxHeight="400px">
autoWidth Boolean false Automatically adjust columns width to the content. <mdb-tbl autoWidth>
fixed Boolean false Sets fixed columns width. <mdb-tbl fixed>

API Reference: mdbTblHead component

All properties and options refered to mdb-tbl-head component.

Name Type Default Description Example
color String Changes TableHead background color. Use MDB color classes <mdb-tbl-head color="primary-color">
textWhite Boolean false Sets TableHead's font color to white. <mdb-tbl-head textWhite>
columns Object[] Binds your data into the component. <mdb-tbl-head columns={this.state.columns}>
.th- class Sets the minimal width of the column (sm - 6rem, lg - 9rem). <mdb-tbl-head> <tr> <th class="th-sm"> Example <th> </tr> </mdb-tbl-head>

API Reference: TableBody component

All properties and options refered to mdb-tbl-body component.

Name Type Default Description Example
colSpan String 1 Spans table cell to the given number of columns. <mdb-tbl-body> <tr> <td colspan="2"> Example <td> </tr> </mdb-tbl-body>

API Reference: Additional Table elements

Name Type Default Description Example
<caption> Node A <caption> functions like a heading for a table. It helps users with screen readers to find a table and understand what it’s about and decide if they want to read it. <caption>Example caption</caption>

Vue Bootstrap Tables - Examples

Here are some example and variations of our basic Table component. Find out how to mix properties, or how does the table with larger amount of data look like.


# First Last Handle First Last Handle
1 Mark Otto @mdo Larry the Bird @twitter
2 Jacob Thornton @fat Mark Otto @mdo
3 Larry the Bird @twitter Jacob Thornton @fat
4 Mark Otto @mdo Larry the Bird @twitter
5 Jacob Thornton @fat Mark Otto @mdo
6 Larry the Bird @twitter Jacob Thornton @fat
7 Mark Otto @mdo Larry the Bird @twitter
8 Jacob Thornton @fat Mark Otto @mdo
9 Larry the Bird @twitter Jacob Thornton @fat