Docs for Table
Insert example code here
| First name | Last name | Website | Optional |
|---|---|---|---|
| Steve | Job | Steve Job | |
| Michael | Smith | Michael Smith | Optional |
Code block
vue
<template>
<button>Focusable element before</button>
<VueTable :fields="fields" :items="items">
<template #cell(website)="{ item }">
<a :href="item.website">{{ item.firstname }} {{ item.surname }}</a>
</template>
<template #cell(optionalLink)="{ item }">
<a v-if="item.optionalLink" :href="item.optionalLink">Optional</a>
<!-- <a v-if="item.optionalLink" :href="item.optionalLink">Optional 2</a> -->
</template>
</VueTable>
<button>Focusable element after</button>
</template>
<script setup lang="ts">
import VueTable from "./components/VueTable.vue";
const items = [
{
firstname: "Steve",
surname: "Job",
website: "https://www.apple.com/",
},
{
firstname: "Michael",
surname: "Smith",
website: "https://www.apple.com/",
optionalLink: "https://www.apple.com/",
},
];
const fields = [
{
key: "firstname",
value: "First name",
},
{
key: "surname",
value: "Last name",
},
{
key: "website",
value: "Website",
},
{
key: "optionalLink",
value: "Optional",
},
];
</script>
<style></style>VueTable
Props
| Prop name | Description | Type | Values | Default |
|---|---|---|---|---|
| fields | Array of type Field { key: string; value: string; } | Array | - | |
| items | Array | - |
Slots
| Name | Description | Bindings |
|---|---|---|
header(${heading.key}) | header(cellname) | data object - whole header itemheader string - key for the header |
cell(${heading.key}) | cell(cellname) | data object - Key valueitem string - Whole data item |
| tfooter | Use this slot for table footer |