All tables in the application are using the BoostrapVue table component.
To use the component, include the <b-table>
tag in the template. The component is registered globally so does not need to be imported in each SFC.
There are a few required properties to maintain consistency across the application. The full list of options can be viewed on the Bootstrap-vue table component's documentation page.
items
- renders table itemsfields
- renders table headerhover
- enables table row hover stateresponsive
or stacked
- makes the table responsive (enables horizontal scrolling or stacked view) at the defined breakpointshow-empty
(required if table data is generated dynamically) - shows an empty message if there are no items in the tableempty-text
(required if table data is generated dynamically) - the translated empty message<template> <b-table hover show-empty responsive="md" :items="items" :fields="fields" :empty-text="$t('global.table.emptyMessage')" /> </template> <script> export default { data() { items: [ { name: 'Babe', age: '3 years', color: 'white, orange, grey' }, { name: 'Grey Boy', age: '4 months', color: 'grey' }, ], fields: [ { key: 'name', label: this.$t('table.name') //translated label }, { key: 'age', label: this.$t('table.age') //translated label }, { key: 'color', label: this.$t('table.color') // translated label } ] } } </script>