v-data-table
component is used for displaying tabular data. Features include sorting, searching, pagination, inline-editing, header tooltips, and row selection. See documentation. The show-select
prop will render a checkbox in the default header to toggle all rows, and a checkbox for each default row. You can customize these with the slots header.data-table-select
and item.data-table-select
respectively. You can also switch between allowing multiple selected rows at the same time or just one with the single-select
prop.
Dessert (100g serving) | Calories | Fat (g) | Carbs (g) | Protein (g) | Iron (%) | |
---|---|---|---|---|---|---|
Frozen Yogurt | 159 | 6 | 24 | 4 | 1% | |
Ice cream sandwich | 237 | 9 | 37 | 4.3 | 1% | |
Eclair | 262 | 16 | 23 | 6 | 7% | |
Cupcake | 305 | 3.7 | 67 | 4.3 | 8% | |
Gingerbread | 356 | 16 | 49 | 3.9 | 16% | |
Jelly bean | 375 | 0 | 94 | 0 | 0% | |
Lollipop | 392 | 0.2 | 98 | 0 | 2% | |
Honeycomb | 408 | 3.2 | 87 | 6.5 | 45% | |
Donut | 452 | 25 | 51 | 4.9 | 22% | |
KitKat | 518 | 26 | 65 | 7 | 6% |
Using the group-by
and group-desc
props you can group rows on an item property. The show-group-by
prop will show a group button in the default header.
Dessert (100g serving)group |
---|
category: Candy |
Jelly bean |
Lollipop |
KitKat |
category: Cookie |
Eclair |
Gingerbread |
category: Ice cream |
Frozen Yogurt |
Ice cream sandwich |
category: Pastry |
Cupcake |
Donut |
category: Toffee |
Honeycomb |
Using the multi-sort
prop will enable you to sort on multiple columns at the same time. When enabled, you can pass arrays to both sort-by
and sort-desc
to programmatically control the sorting, instead of single values.
Dessert (100g serving) | Calories1 | Fat (g)2 | Carbs (g) | Protein (g) | Iron (%) |
---|---|---|---|---|---|
Ice cream sandwich | 200 | 9 | 37 | 4.3 | 1% |
Frozen Yogurt | 200 | 6 | 24 | 4 | 1% |
Eclair | 300 | 16 | 23 | 6 | 7% |
Cupcake | 300 | 3.7 | 67 | 4.3 | 8% |
Gingerbread | 400 | 16 | 49 | 3.9 | 16% |
Honeycomb | 400 | 3.2 | 87 | 6.5 | 45% |
Lollipop | 400 | 0.2 | 98 | 0 | 2% |
Jelly bean | 400 | 0 | 94 | 0 | 0% |
KitKat | 500 | 26 | 65 | 7 | 6% |
Donut | 500 | 25 | 51 | 4.9 | 22% |
The data table exposes a search
prop that allows you to filter your data.
Dessert (100g serving) | Calories | Fat (g) | Carbs (g) | Protein (g) | Iron (%) |
---|---|---|---|---|---|
Frozen Yogurt | 159 | 6 | 24 | 4 | 1% |
Ice cream sandwich | 237 | 9 | 37 | 4.3 | 1% |
Eclair | 262 | 16 | 23 | 6 | 7% |
Cupcake | 305 | 3.7 | 67 | 4.3 | 8% |
Gingerbread | 356 | 16 | 49 | 3.9 | 16% |
Jelly bean | 375 | 0 | 94 | 0 | 0% |
Lollipop | 392 | 0.2 | 98 | 0 | 2% |
Honeycomb | 408 | 3.2 | 87 | 6.5 | 45% |
Donut | 452 | 25 | 51 | 4.9 | 22% |
KitKat | 518 | 26 | 65 | 7 | 6% |