Skip to content

Table

The ETable efficiently displays details, compares items, shows timetables, and lists contacts, enhancing usability by organizing information logically. Demo Here

Usage

vue

<template>
  <ETable
      :headers="headers"
      :items="data"
  />
</template>

<script setup>

  const headers = [
    {title: 'Name', value: 'name'},
    {title: 'Status', value: 'status'},
    {title: 'Date', value: 'date'}
  ]

  const data = [
    {
      name: "Row 1",
      status: "Active",
      date: "15/11/2022",
    },
    {
      name: "Row 2",
      status: "Pending",
      date: "15/11/2022",
    },
    {
      name: "Row 3",
      status: "Error",
      date: "15/11/2022",
    }
  ];
</script>

The main part of the table is the headers array. It details which qualities to show, their labels, arrangement, and appearance. To display anything other than an empty column, the following characteristics must be present: title, value, sortable, sort. All other attributes are optional. The value attribute identifies the column in slots, events, filters, and sort functions.

javascript
const headers = [
    {title: 'Full Name', value: 'name', sortable: true, sort: 'indeterminate '},
    {title: 'Age', value: 'age'},
    {title: 'City', value: 'city'}
]

Note

sortable enables sorting option and sort represents sort order. @values: 'indeterminate', ' asc', 'desc' (Uses an up or down arrow to represent sorting).

Items

Items on a table can be objects with any type or number of attributes. Row selection requires only a unique identity of some type.

javascript
const items = [
    {
        name: "Kate gray",
        age: "24",
        city: "New York",
    }
]

Props

For Table component, the following props are available:

PropTypeDefaultNote
hideHeaderBooleanfalseHides <thead>.
itemsArray-Creates table body.
headersArray-Creates a Header row.
stripedBooleanfalseCreate a zebra striped table.
heightString-Sets the component's height.
borderedBooleanfalseAdds vertical border to the cell.
rowClassesString-Adds a custom class for each row.
stickyHeadBooleanfalseMakes the header of a table stick to the top of the screen.
sizeString"md"The ETable element has three predefined sizes: sm, md, lg.
alignString"start"Specifies how the pagination buttons are distributed along the cross axis in a container. Possible values are start, center and end.
squareBooleanfalseRemoves rounded corners of the element.

Emits

The ETable component contains following emits.

EmitDescription
selectRowEmitted when clicked on tr (table row)
selectTDEmitted when clicked on td (table cell)
sortedEmitted when sort changes

Slots

The ETable component provide following slots that enable you to customize the content.

SlotDescription
header.valueRender custom markup in specific column.
body.valueRender custom markup in specific column.

COPYRIGHT