Rate this docs

Table responsive

Vue Bootstrap table responsive

Responsive tables allow tables to be scrolled horizontally with ease. Make any table responsive across all viewports by adding property responsive. Or, pick a maximum breakpoint with which to have a responsive table up to by using responsive{Sm|Md|Lg|Xl}.

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.


Always responsive

Across every breakpoint, use prop responsive for horizontally scrolling tables.

# 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 color="primary-color" textWhite>
                <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 scope="row"> 
                  <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 scope="row">
                  <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 scope="row">
                  <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: 'TableResponsivePage',
            components: {
              mdbTbl,
              mdbTblHead,
              mdbTblBody
            }
          };
        </script>
        
        <!-- Add "scoped" attribute to limit CSS to this component only -->
        <style scoped>
        
        </style>
                    
      

Breakpoint specific

Use responsive{Sm|Md|Lg|Xl} as needed to create responsive tables up to a particular breakpoint. From that breakpoint and up, the table will behave normally and not scroll horizontally.

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

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

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

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


        <template>
          <mdb-tbl responsiveSm>
            ...
          </mdb-tbl>

          <mdb-tbl responsiveMd>
            ...
          </mdb-tbl>

          <mdb-tbl responsiveLg>
            ...
          </mdb-tbl>

          <mdb-tbl responsiveXl>
            ...
          </mdb-tbl>
        </template>

      

Bootstrap table column width

Use one of the following properties to manipulate the width of the columns.

Table columns with auto width

Add prop autoWidth to the mdbTbl element to set an auto width to the table column.

The width of the columns will automatically adjust to the content of the column. That means it will always take a minimum width required to present its content.

# Name Surname Country City Position Age
1 Kate Moss USA New York City Web Designer 23
2 Anna Wintour United Kingdom London Frontend Developer 36
3 Tom Bond Spain Madrid Photographer 25
4 Jerry Horwitz Italy Bari Editor-in-chief 41
5 Janis Joplin Poland Warsaw Video Maker 39
6 Gary Winogrand Germany Berlin Photographer 37
7 Angie Smith USA San Francisco Teacher 52
8 John Mattis France Paris Actor 28
9 Otto Morris Germany Munich Singer 35

        <template>
          <mdb-tbl responsive autoWidth>
            <mdb-tbl-head>
              <tr>
                <th>#</th>
                <th>Name</th>
                <th>Surname</th>
                <th>Country</th>
                <th>City</th>
                <th>Position</th>
                <th>Age</th>
              </tr>
            </mdb-tbl-head>
            <mdb-tbl-body>
              <tr class="table-info">
                <th scope="row">1</th>
                <td>Kate</td>
                <td>Moss</td>
                <td>USA</td>
                <td>New York City</td>
                <td>Web Designer</td>
                <td>23</td>
              </tr>
              <tr>
                <th scope="row">2</th>
                <td>Anna</td>
                <td>Wintour</td>
                <td>United Kingdom</td>
                <td>London</td>
                <td>Frontend Developer</td>
                <td>36</td>
              </tr>
              <tr class="table-info">
                <th scope="row">3</th>
                <td>Tom</td>
                <td>Bond</td>
                <td>Spain</td>
                <td>Madrid</td>
                <td>Photographer</td>
                <td>25</td>
              </tr>
              <tr>
                <th scope="row">4</th>
                <td>Jerry</td>
                <td>Horwitz</td>
                <td>Italy</td>
                <td>Bari</td>
                <td>Editor-in-chief</td>
                <td>41</td>
              </tr>
              <tr class="table-info">
                <th scope="row">5</th>
                <td>Janis</td>
                <td>Joplin</td>
                <td>Poland</td>
                <td>Warsaw</td>
                <td>Video Maker</td>
                <td>39</td>
              </tr>
              <tr>
                <th scope="row">6</th>
                <td>Gary</td>
                <td>Winogrand</td>
                <td>Germany</td>
                <td>Berlin</td>
                <td>Photographer</td>
                <td>37</td>
              </tr>
              <tr class="table-info">
                <th scope="row">7</th>
                <td>Angie</td>
                <td>Smith</td>
                <td>USA</td>
                <td>San Francisco</td>
                <td>Teacher</td>
                <td>52</td>
              </tr>
              <tr>
                <th scope="row">8</th>
                <td>John</td>
                <td>Mattis</td>
                <td>France</td>
                <td>Paris</td>
                <td>Actor</td>
                <td>28</td>
              </tr>
              <tr class="table-info">
                <th scope="row">9</th>
                <td>Otto</td>
                <td>Morris</td>
                <td>Germany</td>
                <td>Munich</td>
                <td>Singer</td>
                <td>35</td>
              </tr>
            </mdb-tbl-body>
          </mdb-tbl>
        </template>
        <script>
          import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue';
          
          export default {
            name: 'TableResponsivePage',
            components: {
              mdbTbl,
              mdbTblHead,
              mdbTblBody
            }
          };
        </script>
          
        <!-- Add "scoped" attribute to limit CSS to this component only -->
        <style scoped>
        
        </style>
              
      

Table columns with minimal width

Use .th-lg or .th-sm class to set a minimal width of a table column. .th-lg class gives 9 rem of the minimal width of the column and .th-sm class gives 6 rem.

You have to add .th-lg or th.sm class to the <th> element within the <mdb-tbl-head>.

Resize the browser window to see the effect.

.th-lg - 9 rem minimal width of the column

# Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor
1 Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor
2 Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor
3 Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor

        <template>
          <mdb-tbl responsive>
            <mdb-tbl-head>
              <tr>
                <th>#</th>
                <th class="th-lg">Lorem ipsum dolor</th>
                <th class="th-lg">Lorem ipsum dolor</th>
                <th class="th-lg">Lorem ipsum dolor</th>
              </tr>
            </mdb-tbl-head>
            <mdb-tbl-body>
              <tr>
                <th scope="row">1</th>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
              </tr>
              <tr>
                <th scope="row">2</th>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
              </tr>
              <tr>
                <th scope="row">3</th>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
              </tr>
            </mdb-tbl-body>
          </mdb-tbl>
        </template>
        <script>
          import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue';
          
          export default {
            name: 'TableResponsivePage',
            components: {
              mdbTbl,
              mdbTblHead,
              mdbTblBody
            }
          };
        </script>
          
        <!-- Add "scoped" attribute to limit CSS to this component only -->
        <style scoped>
        
        </style>
      

.th-sm - 6 rem minimal width of the column

# Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor
1 Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor
2 Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor
3 Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor

        <template>
          <mdb-tbl responsive>
            <mdb-tbl-head>
              <tr>
                <th>#</th>
                <th class="th-sm">Lorem ipsum dolor</th>
                <th class="th-sm">Lorem ipsum dolor</th>
                <th class="th-sm">Lorem ipsum dolor</th>
              </tr>
            </mdb-tbl-head>
            <mdb-tbl-body>
              <tr>
                <th scope="row">1</th>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
              </tr>
              <tr>
                <th scope="row">2</th>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
              </tr>
              <tr>
                <th scope="row">3</th>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
                <td>Lorem ipsum dolor</td>
              </tr>
            </mdb-tbl-body>
          </mdb-tbl>
        </template>
        <script>
          import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue';
          
          export default {
            name: 'TableResponsivePage',
            components: {
              mdbTbl,
              mdbTblHead,
              mdbTblBody
            }
          };
        </script>
          
        <!-- Add "scoped" attribute to limit CSS to this component only -->
        <style scoped>
        
        </style>
      

Table columns with fixed width

Add prop fixed to the mdb-tbl element to set a fixed width to the all columns of the table.

# Name Surname Country City Position Age
4 Jerry Horwitz Italy Bari Editor-in-chief 41
5 Janis Joplin Poland Warsaw Video Maker 39
6 Gary Winogrand Germany Berlin Photographer 37
7 Angie Smith USA San Francisco Teacher 52
8 John Mattis France Paris Actor 28
9 Otto Morris Germany Munich Singer 35

          <template>
            <mdb-tbl responsive fixed>
              <mdb-tbl-head>
                <tr>
                  <th>#</th>
                  <th>Name</th>
                  <th>Surname</th>
                  <th>Country</th>
                  <th>City</th>
                  <th>Position</th>
                  <th>Age</th>
                </tr>
              </mdb-tbl-head>
              <mdb-tbl-body>
                <tr>
                  <th scope="row">4</th>
                  <td>Jerry</td>
                  <td>Horwitz</td>
                  <td>Italy</td>
                  <td>Bari</td>
                  <td>Editor-in-chief</td>
                  <td>41</td>
                </tr>
                <tr>
                  <th scope="row">5</th>
                  <td>Janis</td>
                  <td>Joplin</td>
                  <td>Poland</td>
                  <td>Warsaw</td>
                  <td>Video Maker</td>
                  <td>39</td>
                </tr>
                <tr>
                  <th scope="row">6</th>
                  <td>Gary</td>
                  <td>Winogrand</td>
                  <td>Germany</td>
                  <td>Berlin</td>
                  <td>Photographer</td>
                  <td>37</td>
                </tr>
                <tr>
                  <th scope="row">7</th>
                  <td>Angie</td>
                  <td>Smith</td>
                  <td>USA</td>
                  <td>San Francisco</td>
                  <td>Teacher</td>
                  <td>52</td>
                </tr>
                <tr>
                  <th scope="row">8</th>
                  <td>John</td>
                  <td>Mattis</td>
                  <td>France</td>
                  <td>Paris</td>
                  <td>Actor</td>
                  <td>28</td>
                </tr>
                <tr>
                  <th scope="row">9</th>
                  <td>Otto</td>
                  <td>Morris</td>
                  <td>Germany</td>
                  <td>Munich</td>
                  <td>Singer</td>
                  <td>35</td>
                </tr>
              </mdb-tbl-body>
            </mdb-tbl>
          </template>
          <script>
            import { mdbTbl, mdbTblHead, mdbTblBody } from 'mdbvue';
            
            export default {
              name: 'TableResponsivePage',
              components: {
                mdbTbl,
                mdbTblHead,
                mdbTblBody
              }
            };
          </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>