Column

Column is required to be used within Table.

Demos

See the demos of Table.

API

Props

NameTypeDefaultDescription
titlestring-The column title.
fieldstring-The field name as a key of items in the data prop of the parent Table component.
widthstring=|number=-The column width in px value.
sortablebooleanfalse

Whether current column is sortable.

Table and Column do not handle sorting. They only emit a sort event when the sorter is clicked so users need handle sorting themselves.

alignstring=-The alignment of cell content in the column. Supports left/center/right.
spanfunction(number): Object

A function that defines how cells should span across rows/columns. The type is function(index: number): { row: number, col: number }, where index being the index of current row inside the data prop of the parent Table. The row/col of the return value correspond to table cell's rowspan/colspan attribut, with a default value of 1.

You can learn more abut how to use this in Table component's Demos › Advanced.

Slots

NameDescription
headThe table head.
foot

The table foot.

Column's foot slot will be ignored if users provide content for Table's foot slot.

default

The content of the table cell. Displays the property value corresponds to the field property in table's data prop.

The slot scope properties are the same as each item inside data, with an extra index: number, which denotes the index within the row data.

sub-row

The content of cells in a sub row. Sub row data comes from the children array inside the row data in Tables data prop. The number of sub rows are determined by the length of the children array and the sub rows share the same column configuration with the table.

Displays the value keyed by field prop inside the sub row data, which is data[i].children[j] of the parent table.

The slot scope properties are the same as each item inside children, with an extra index: number, which denotes the index within the row data.

The sub-row slot of Column will be ignored when content is provided for Table's sub-row slot.