Skip to content

Table ​

A secondary encapsulation of the element-plus table component. Simplifies table configuration.

Table only owns the presentation contract. It does not handle request, pagination, or page workflow concerns. Cell rendering priority is: column slot > formatter > emptyValue > nullishText (default '--', triggers only on null / undefined) > default field value.

The exported TableColumn type is an Ez-UI maintained public boundary. It does not directly expose Element Plus internal column context types; apart from the documented extension fields, other public column props continue to be forwarded to el-table-column.

Default Nullish Fallback

For data columns that do not declare a formatter or emptyValue, Ez-UI auto-injects a default formatter: when the cell's raw value is null or undefined, it renders as nullishText (default '--'); empty string '' is NOT treated as nullish and is passed through unchanged. The priority is always: column-level formatter > column-level emptyValue > auto-injected nullishText fallback.

Basic Usage ​

Tree Table ​

Functional Table ​

Nullish Fallback ​

Table Attributes ​

AttributeDescriptionTypeExtensibleDefault Value
dataTable dataArrayNo[]
columnsColumn configurationTableColumn[]Yes[]
heightHeight of the table. Defaults to automatic height, and the table's height is controlled by external styles.enumNo—
max-heightMaximum height of the tableenumNo—
stripeWhether to use striped rowsbooleanNofalse
borderWhether to have vertical bordersbooleanNotrue
sizeSize of the TableenumNo—
fitWhether the column width should stretch to fitbooleanNotrue
show-headerWhether to show the table headerbooleanNotrue
highlight-current-rowWhether to highlight the current rowbooleanNofalse
current-row-keyKey of the current row, read-onlyenumNo—
row-class-nameCallback method for row className, or use a string to set a fixed className for all rows.enumNo—
row-styleCallback method for row style, or use a fixed Object to set the same style for all rows.enumNo—
cell-class-nameCallback method for cell className, or use a string to set a fixed className for all cells.enumNo—
cell-styleCallback method for cell style, or use a fixed Object to set the same style for all cells.enumNo—
header-row-class-nameCallback method for header row className, or use a string to set a fixed className for all header rows.enumNo—
header-row-styleCallback method for header row style, or use a fixed Object to set the same style for all header rows.enumNo—
header-cell-class-nameCallback method for header cell className, or use a string to set a fixed className for all header cells.enumNo—
header-cell-styleCallback method for header cell style, or use a fixed Object to set the same style for all header cells.enumNo—
row-keyKey for row data to optimize Table rendering; required when using reserve-selection functionality or displaying tree data.enumNoid
empty-textText content to display when there is no data; can also be set through a slot.stringNoNo Data
default-expand-allWhether to expand all rows by default, effective when the Table contains expandable rows or is a tree table.booleanNofalse
expand-row-keysSet the currently expanded rows using this property; needs row-key to be set, this property is an array of expanded row keys.ArrayNo—
default-sortDefault sorting column's prop and order. The prop attribute specifies the default sorting column, order specifies the default sorting order.objectNoprop set, order default ascending
tooltip-effectEffect of the overflow tooltipenumNodark
tooltip-optionsOptions for overflow tooltip, refer to the tooltip component below.objectNoobject
show-summaryWhether to show a summary row at the bottom of the tablebooleanNofalse
sum-textText to display in the first column of the summary rowstringNoSum
summary-methodCustom summary calculation methodFunctionNo—
span-methodMethod to merge rows or columnsFunctionNo—
select-on-indeterminateIn a multi-select table, the behavior when only some rows are selected and the header checkbox is clicked. If true, select all rows; if false, deselect all rows.booleanNotrue
indentIndentation of tree nodes when displaying tree datanumberNo16
lazyWhether to lazily load child node databooleanNofalse
loadFunction to load child node data, effective when lazy is true.FunctionNo—
tree-propsConfiguration options for rendering nested dataobjectNoobject
table-layoutSet the layout method for table cells, rows, and columnsenumNofixed
scrollbar-always-onAlways show scrollbarsbooleanNofalse
show-overflow-tooltipWhether to hide extra content and use Tooltip to show them on hover. This affects the display of all columns.enumNo—
flexibleEnsure the minimum size of the main axis to avoid overflow of content.booleanNofalse
nullish-textDefault placeholder for nullish cell values; only applies to data columns without formatter / emptyValue. Triggers on null / undefined; empty string '' passes through.stringYes'--'

TableColumn Attributes ​

AttributeDescriptionTypeExtensibleDefault Value
typeColumn type. If set to selection, shows a checkbox; if set to index, shows the row index (starting from 1); if set to expand, shows an expandable button.enumNodefault
indexIf type=index is set, you can use the index property to customize the index.enumNo—
labelDisplay titlestringNo—
column-keyColumn key, required to identify which column's filter conditions are being used for filter-change events.stringNo—
propField name corresponding to the column's content, can also use the property attribute.stringNo—
widthWidth of the columnenumNo''
min-widthMinimum width of the column. Unlike width, min-width allocates remaining width proportionally to columns with min-width set.enumNo''
fixedWhether the column is fixed to the left or right. True indicates fixed to the left.enumNofalse
render-headerFunction for rendering the column header label areaFunctionNo—
sortableWhether the column can be sorted. If set to 'custom', remote sorting is needed and the Table's sort-change event needs to be listened to.enumNofalse
sort-modeSorting mode. local keeps Element Plus local sorting, remote automatically normalizes sortable to customenumYeslocal
sort-fieldRemote sorting field name. Defaults to the current column propstringYes—
sort-methodSpecify which property the data is sorted by, valid only when sortable is true. Should return a Number like Array.sort.FunctionNo—
sort-bySpecify which property the data is sorted by, valid only when sortable is true and no sort-method is set. If sort-by is an array, it sorts by the first property, then the second if the first is the same.enumNo—
sort-ordersthe order of the sorting strategies used when sorting the data, works when sortable is true. Accepts an array, as the user clicks on the header, the column is sorted in order of the elements in the arrayobjectNo['ascending', 'descending', null]
resizablewhether column width can be resized, works when border of el-table is truebooleanNotrue
formatterFunction that formats cell content. Effective when no same-name column slot is providedFunctionNo—
empty-valueFallback text when the current cell value is empty. Applied after formatter and before the default field valuestringYes—
show-overflow-tooltipwhether to hide extra content and show them in a tooltip when hovering on the cellenumNoundefined
alignalignmentenumNocenter
header-alignalignment of the table header. If omitted, the value of the above align attribute will be appliedenumNocenter
class-nameclass name of cells in the columnstringNo—
label-class-nameclass name of the label of this columnstringNo—
hiddenWhether to hide the column. true means hiddenbooleanYesfalse
selectablefunction that determines if a certain row can be selected, works when type is 'selection'FunctionNo—
reserve-selectionwhether to reserve selection after data refreshing, works when type is 'selection'. Note that row-key is required for this to workbooleanNofalse
filtersan array of data filtering options. For each element in this array, text and value are requiredobjectNo—
filter-placementplacement for the filter dropdownenumNo—
filter-class-nameclassName for the filter dropdownstringNo—
filter-multiplewhether data filtering supports multiple optionsbooleanNotrue
filter-methoddata filtering method. If filter-multiple is on, this method will be called multiple times for each row, and a row will display if one of the calls returns truefunctionNo—
filtered-valuefilter value for selected data, might be useful when table header is rendered with render-headerobjectNo—

Notes: Ez-UI provides default values of align: 'center' and resizable: true; showOverflowTooltip is disabled by default for the last visible data column, which is commonly used as an operation column.

Slots ​

NameDescriptionType
${prop}Slot for data columns, suitable for complex data processingobject
header-${prop}General header slot, associated through the prop of columns itemobject
appendContent inserted after the last row of the table-
emptyCustom content when data is empty-

Events ​

NameDescriptionTypeExpand
selectEvent triggered when the user manually checks a data row's checkboxFunctionNo
select-allEvent triggered when the user manually checks the "select all" checkboxFunctionNo
selection-changeEvent triggered when the selected items changeFunctionNo
cell-mouse-enterEvent triggered when hovering enters a cellFunctionNo
cell-mouse-leaveEvent triggered when hovering leaves a cellFunctionNo
cell-clickEvent triggered when a cell is clickedFunctionNo
cell-dblclickEvent triggered when a cell is double-clickedFunctionNo
cell-contextmenuEvent triggered when a cell is right-clickedFunctionNo
row-clickEvent triggered when a row is clickedFunctionNo
row-contextmenuEvent triggered when a row is right-clickedFunctionNo
row-dblclickEvent triggered when a row is double-clickedFunctionNo
header-clickEvent triggered when a column header is clickedFunctionNo
header-contextmenuEvent triggered when a column header is right-clickedFunctionNo
sort-changeEvent triggered when the table's sorting conditions changeFunctionNo
filter-changeKey of the column; if you need to use the filter-change event, this property identifies which column's filter conditionFunctionNo
current-changeEvent triggered when the table's current row changes. If you want to highlight the current row, enable the table's highlight-current-row propertyFunctionNo
header-dragendEvent triggered when the width of a column is changed by dragging the column headerFunctionNo
expand-changeEvent triggered when a user expands or collapses a row (when expanding rows, the second parameter of the callback is expandedRows; for tree tables, the second parameter is expanded)FunctionNo

Table Exposes ​

Method NameDescriptionType
getTableRefGet el-table instance (escape hatch)Function
clearSelectionClear user's selectionFunction
toggleRowSelectionToggle selection state of a specific rowFunction
toggleAllSelectionToggle between select all and deselect allFunction
toggleRowExpansionToggle expansion state of a specific rowFunction
setCurrentRowSet a row as the selected rowFunction
clearSortClear the sorting conditionFunction
clearFilterClear filter conditions for specified columnsFunction
doLayoutRe-layout the TableFunction
sortManually sort the tableFunction

💡 The methods above can be called directly on the EzTable instance. For other el-table methods (e.g., scrollTo, getSelectionRows), use getTableRef() to access the underlying instance.

Released under the MIT License