Skip to content

Table - Web Component โ€‹

Browser support โ€‹

Detected engine: ย 

  • Chromium

  • Webkit

  • Gecko

Parameters โ€‹

The Web component uses the <z-table> tag:

By default, all the parameters are optional or can be set in different, except for the ones marked as required

The parametrization of the component can be done with the following custom HTML params:

NameTypeDescriptionSlot
headersobject[]
rowsobject[]
captionstring

headers โ€‹

The headers attribute is used to define the table headers.

You can pass an array of numbers or string (number | string)[]:

We can use the head-<index> slots to customize content:

Info
Configured headers โ€‹

But there's an option of passing config objects if each row of the table is going to represent an object. In this case, rows will be the array of key-value pairs objects and headers an array of these config objects where we choose the property of the object that will go in that column (prop) and a name or text for that column (text):

rows โ€‹

The rows attribute is used to define the table rows.

Like the headers attribute, you can pass either pass a matrix of numbers or string (number | string)[][]:

We can use the cell-<row>-<index> slots to customize content:

Cell prop
Object rows โ€‹

rows can also be objects, and in that case, the properties will be displayed in order per column:

We can use the cell-<row>-<prop> slots to customize content:

Cell prop

caption โ€‹

The caption attribute is used to define the table caption.

Using embedded table โ€‹

You can also embed and entire table component. For this, a <table> tag needs to be placed inside:

Head 1Head 2Head 3
Cell 1-1Cell 1-2Cell 1-3
Cell 2-1Cell 2-2Cell 2-3

Rows โ€‹

...

Cells โ€‹

config โ€‹

The config attribute in <td> or <th> tags can change the positioning of the content:

LeftCenterRight

Dynamic tables โ€‹

The embed table allow us to have full control of the table or even use other components inside:

Sel.NamePriceQt.Total
Item name 1
Item name 2
Item name 3
Total:

Playground โ€‹

Customization โ€‹

HTML Examples โ€‹

StackBlitz example โ€‹