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>
            <tbl responsive>
              <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>
              </tbl-head>
              <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>
              </tbl-body>
            </tbl>
          </div>
        </template>

        <script>
          import { Tbl, TblHead, TblBody } from 'mdbvue';
          
          export default {
            name: 'TableResponsivePage',
            components: {
              Tbl,
              TblHead,
              TblBody
            }
          };
        </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>
          <tbl responsiveSm>
            ...
          </tbl>

          <tbl responsiveMd>
            ...
          </tbl>

          <tbl responsiveLg>
            ...
          </tbl>

          <tbl responsiveXl>
            ...
          </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 tbl 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>
          <tbl responsive autoWidth>
            <tbl-head>
              <tr>
                <th>#</th>
                <th>Name</th>
                <th>Surname</th>
                <th>Country</th>
                <th>City</th>
                <th>Position</th>
                <th>Age</th>
              </tr>
            </tbl-head>
            <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>
            </tbl-body>
          </tbl>
        </template>
        <script>
          import { Tbl, TblHead, TblBody } from 'mdbvue';
          
          export default {
            name: 'TableResponsivePage',
            components: {
              Tbl,
              TblHead,
              TblBody
            }
          };
        </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 <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>
          <tbl responsive>
            <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>
            </tbl-head>
            <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>
            </tbl-body>
          </tbl>
        </template>
        <script>
          import { Tbl, TblHead, TblBody } from 'mdbvue';
          
          export default {
            name: 'TableResponsivePage',
            components: {
              Tbl,
              TblHead,
              TblBody
            }
          };
        </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>
          <tbl responsive>
            <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>
            </tbl-head>
            <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>
            </tbl-body>
          </tbl>
        </template>
        <script>
          import { Tbl, TblHead, TblBody } from 'mdbvue';
          
          export default {
            name: 'TableResponsivePage',
            components: {
              Tbl,
              TblHead,
              TblBody
            }
          };
        </script>
          
        <!-- Add "scoped" attribute to limit CSS to this component only -->
        <style scoped>
        
        </style>
      

Table columns with fixed width

Add prop fixed to the 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>
            <tbl responsive fixed>
              <tbl-head>
                <tr>
                  <th>#</th>
                  <th>Name</th>
                  <th>Surname</th>
                  <th>Country</th>
                  <th>City</th>
                  <th>Position</th>
                  <th>Age</th>
                </tr>
              </tbl-head>
              <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>
              </tbl-body>
            </tbl>
          </template>
          <script>
            import { Tbl, TblHead, TblBody } from 'mdbvue';
            
            export default {
              name: 'TableResponsivePage',
              components: {
                Tbl,
                TblHead,
                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.

Tables - getting started : download & setup


Download

All the components and features are part of MDBootstrap for Vue package.

MDBootstrap (Material Design for Bootstrap) is a free (MIT Licensed) framework combining Material Design and the newest Bootstrap 4 with Vue.

Click the button below to go to Download Page, where you can download MDBootstrap package.

MDBootstrap Vue version Download MDBootstrap (Vue version) About

MDB Pro

Using components and features labeled as MDB Pro component requires MDB Pro package.

Click the button below to learn more about MDBbootstrap Pro package

MDBootstrap Pro

Tutorials

If you need additional help to start, use our "5 min Quick Start".

5 min Quick Start

Compilation & Customization tutorial

If you need additional help to compile your custom package, use our Compilation & Customization tutorial

Compilation & Customization tutorial