How to create a somple table in Bootstrap VueJS?

Hi Friends 👋,

Welcome To SortoutCode! ❤️

To create the simple table in BootstrapVue.We are using the <b-table-simple> component to create the simple table and this component gives the user complete control over the rendering of the table content in BootstrapVue.

Today I am going to show you How do you create a simple table in bootstrap-vue?

Table of contains

  • Install the Bootstrap and BootstrapVue
  • Create FirstComponent.vue and import it into App.js
  • Create simple table using b-table-simple component

Let’s start today’s tutorial let’s check the examples of how to create a simple table in BootstrapVue?

Install the Bootstrap and BootstrapVue

First, we have to install the Vue project, I had installed the vueJS in my system. If you haven’t installed or have any problem with installation you can follow this article, it will show you step by step process of installation. In that article, I had also show you how to install BootstrapVue in your vue.js project step by step.

How to install or configure vue-bootstrap in VueJS?

Create FirstComponent.vue and import it into App.js

Create the new component into src/components/ components folder.the component name is FirstComponent.vue and import into App.js file:

App.js

<template>
  <div id="app">
    <FirstComponent />
  </div>
</template>

<script>
import FirstComponent from "./components/FirstComponent.vue";
export default {
  name: "App",
  components: {
    FirstComponent,
  },
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

Create simple table using b-table-simple component

We are going to create the simple table using the <b-table-simple> component. This <b-table-simple> component gives complete control over how we want to render the table. <b-table-simple> is a wrapper component around the <table> element. Inside the component, via the default slot, you can use any or all of the BootstrapVue table helper components <b-thead>, <b-tfoot>, <b-tbody>, <b-tr>, <b-th>, <b-td>.

<template>
  <div class="hello">
    <b-table-simple>
      <b-thead>
        <b-tr>
          <b-th>No.</b-th>
          <b-th>Website Name</b-th>
          <b-th>Website URL</b-th>
          <b-th>Website Status</b-th>
        </b-tr>
      </b-thead>
      <b-tbody>
        <b-tr>
          <b-td>1</b-td>
          <b-td>SortoutCode</b-td>
          <b-td>https://sortoutcode.com/</b-td>
          <b-td>Active</b-td>
        </b-tr>
        <b-tr>
          <b-td>2</b-td>
          <b-td>Aguidehub</b-td>
          <b-td>https://aguidehub.com/</b-td>
          <b-td>Active</b-td>
        </b-tr>
        <b-tr>
          <b-td>3</b-td>
          <b-td>Infinitbility</b-td>
          <b-td>https://infinitbility.com/</b-td>
          <b-td>Active</b-td>
        </b-tr>
      </b-tbody>
    </b-table-simple>
  </div>
</template>

<script>
export default {
  name: "FirstComponent",
};
</script>

For now, let’s check the output.

Output

BootstrapVue Simple table

All the best 👍.

Follow me on Twitter