Usage
Utilise our compositional table components TableContainer
, Table
, TableData
& TableHeader
to construct a styled table.
Name | Location | |
---|---|---|
Ryan Ede | ryan.ede@cudoventures.com | England |
Ryan Ede 2 | ryan.ede+2@cudoventures.com | Scotland |
Ryan Ede 3 | ryan.ede+3@cudoventures.com | Ireland |
Ryan Ede 4 | ryan.ede+4@cudoventures.com | Wales |
<template>
<CTableContainer class="w-full">
<CTable>
<template #headers>
<CTableHeader>
Name
</CTableHeader>
<CTableHeader>
Email
</CTableHeader>
<CTableHeader>
Location
</CTableHeader>
</template>
<template #rows>
<tr
v-for="item in [
{
name: 'Ryan Ede',
email: 'ryan.ede@cudoventures.com',
location: 'England',
},
{
name: 'Ryan Ede 2',
email: 'ryan.ede+2@cudoventures.com',
location: 'Scotland',
},
{
name: 'Ryan Ede 3',
email: 'ryan.ede+3@cudoventures.com',
location: 'Ireland',
},
{
name: 'Ryan Ede 4',
email: 'ryan.ede+4@cudoventures.com',
location: 'Wales',
},
]"
:key="item.name"
>
<CTableData>{{ item.name }}</CTableData>
<CTableData>{{ item.email }}</CTableData>
<CTableData>{{ item.location }}</CTableData>
</tr>
</template>
</CTable>
</CTableContainer>
</template>
Bordered
For a bordered table, the CTableContainer
component accepts a border prop.
Name | Location | |
---|---|---|
Ryan Ede | ryan.ede@cudoventures.com | England |
Ryan Ede 2 | ryan.ede+2@cudoventures.com | Scotland |
Ryan Ede 3 | ryan.ede+3@cudoventures.com | Ireland |
Ryan Ede 4 | ryan.ede+4@cudoventures.com | Wales |
<template>
<CTableContainer
class="w-full"
border
>
<CTable>
<template #headers>
<CTableHeader>
Name
</CTableHeader>
<CTableHeader>
Email
</CTableHeader>
<CTableHeader>
Location
</CTableHeader>
</template>
<template #rows>
<tr
v-for="item in [
{
name: 'Ryan Ede',
email: 'ryan.ede@cudoventures.com',
location: 'England',
},
{
name: 'Ryan Ede 2',
email: 'ryan.ede+2@cudoventures.com',
location: 'Scotland',
},
{
name: 'Ryan Ede 3',
email: 'ryan.ede+3@cudoventures.com',
location: 'Ireland',
},
{
name: 'Ryan Ede 4',
email: 'ryan.ede+4@cudoventures.com',
location: 'Wales',
},
]"
:key="item.name"
>
<CTableData>{{ item.name }}</CTableData>
<CTableData>{{ item.email }}</CTableData>
<CTableData>{{ item.location }}</CTableData>
</tr>
</template>
</CTable>
</CTableContainer>
</template>
Props
TableContainer
border
boolean