Member-only story

Buefy — Customize Table Rows and Columns

John Au-Yeung
3 min readJan 11, 2021

--

Photo by Liana Mikah on Unsplash

Buefy is a UI framework that’s based on Bulma.

In this article, we’ll look at how to use Buefy in our Vue app.

Row Status

We can set the row-class prop by checking the row data with a function.

For example, we can write:

<template>
<div id="app">
<b-table :data="data" :columns="columns" :row-class="(row, index) => row.id === 1 && 'is-info'"></b-table>
</div>
</template>
<script>
export default {
name: "App",
data() {
const data = [
{
id: 1,
first_name: "james",
last_name: "smith"
},
{
id: 2,
first_name: "mary",
last_name: "jones"
},
{
id: 3,
first_name: "alex",
last_name: "wong"
}
];
return {
data,
columns: [
{
field: "id",
label: "ID",
width: "40",
numeric: true
},
{
field: "first_name",
label: "First Name"
},
{
field: "last_name",
label: "Last Name"
}
]
};
}
};
</script>
<style>
tr.is-info {
background: #167df0;
color: #fff;
}
</style>

--

--

No responses yet