Rate this docs

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,
              TblBody
            }
          };
        </script>
        
        <!-- Add "scoped" attribute to limit CSS to this component only -->
        <style scoped>
        
        </style>
      

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,
                TblBody
              }
            };
          </script>
          
          <!-- Add "scoped" attribute to limit CSS to this component only -->
          <style scoped>
          
          </style>
      

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,
                TblBody
              }
            };
          </script>
          
          <!-- Add "scoped" attribute to limit CSS to this component only -->
          <style scoped>
          
          </style>
        

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,
              TblBody
            }
          };
        </script>
        
        <!-- Add "scoped" attribute to limit CSS to this component only -->
        <style scoped>
        
        </style>
      

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,
              TblBody
            }
          };
        </script>
        
        <!-- Add "scoped" attribute to limit CSS to this component only -->
        <style scoped>
        
        </style>
      

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,
              TblBody
            }
          };
        </script>
        
        <!-- Add "scoped" attribute to limit CSS to this component only -->
        <style scoped>
        
        </style>
      

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,
              TblBody
            }
          };
        </script>
        
        <!-- Add "scoped" attribute to limit CSS to this component only -->
        <style scoped>
        
        </style>
      

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,
              TblBody
            }
          };
        </script>
        
        <!-- Add "scoped" attribute to limit CSS to this component only -->
        <style scoped>
        
        </style>
      

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,
              TblBody
            }
          };
        </script>
        
        <!-- Add "scoped" attribute to limit CSS to this component only -->
        <style scoped>
        
        </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