Skip to content

Table - CSS Component

The Table component can be used imported from:

Playground

Construction

The CSS component uses the <table> tag with the z-table HTML custom attribute.

z-table

The z-table is the main parameter used to render the table component. The table component is used to display data in a tabular format. The css component is working exactly like the native HTML table tag.

NameAgeCountry
John Doe30Switzerland
John Smith35Spain

Caption

You can add a caption to the table by using the <caption> tag.

Users
NameAgeCountry
John Doe30Switzerland
John Smith35Spain

Cells

config

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

LeftCenterRight

zebra

We can use the zebra attribute to set a highlighted background in the even rows

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

Using zebra="odd" will apply it to odd ones:

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

highlight

We can can highlight an entire column of the table just placing the highlight attribute in the header of the corresponding column:

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

Browser support

Detected engine:  

  • Chromium

  • Webkit

  • Gecko

HTML Examples

CodeSandbox example