Table

@ui5/webcomponents
<ui5-table>

Basic Table

Products table - resize your browser to make some columns pop-in Toggle Sticky Column Header
Product Supplier Dimensions Weight Price
<!-- Header -->
<div class="header">
	<span>Products table - resize your browser to make some columns pop-in</span>
	<button id="toggleSticky" style="height: 32px">Toggle Sticky Column Header</button>
</div>

<ui5-table class="demo-table" id="table">
	<!-- Columns -->
	<ui5-table-column slot="columns" style="width: 12rem">
		<span style="line-height: 1.4rem">Product</span>
	</ui5-table-column>

	<ui5-table-column slot="columns" min-width="800">
		<span style="line-height: 1.4rem">Supplier</span>
	</ui5-table-column>

	<ui5-table-column slot="columns" min-width="600" popin-text="Dimensions" demand-popin>
		<span style="line-height: 1.4rem">Dimensions</span>
	</ui5-table-column>

	<ui5-table-column slot="columns" min-width="600" popin-text="Weight" demand-popin>
		<span style="line-height: 1.4rem">Weight</span>
	</ui5-table-column>

	<ui5-table-column slot="columns">
		<span style="line-height: 1.4rem">Price</span>
	</ui5-table-column>

	<ui5-table-row>
		<ui5-table-cell>Notebook Basic 15HT-1000</ui5-table-cell>
		<ui5-table-cell>Very Best Screens</ui5-table-cell>
		<ui5-table-cell>30 x 18 x 3cm</ui5-table-cell>
		<ui5-table-cell>4.2KG</ui5-table-cell>
		<ui5-table-cell>956EUR</ui5-table-cell>
	</ui5-table-row>

	<ui5-table-row>
		<ui5-table-cell>Notebook Basic 17HT-1001</ui5-table-cell>
		<ui5-table-cell>Very Best Screens</ui5-table-cell>
		<ui5-table-cell>29 x 17 x 3.1cm</ui5-table-cell>
		<ui5-table-cell>4.5KG</ui5-table-cell>
		<ui5-table-cell>1249EUR</ui5-table-cell>
	</ui5-table-row>

	<ui5-table-row>
		<ui5-table-cell>Notebook Basic 18HT-1002</ui5-table-cell>
		<ui5-table-cell>Very Best Screens</ui5-table-cell>
		<ui5-table-cell>28 x 19 x 2.5cm</ui5-table-cell>
		<ui5-table-cell>4.2KG</ui5-table-cell>
		<ui5-table-cell>1570EUR</ui5-table-cell>
	</ui5-table-row>

	...
</ui5-table>
	

Table in SingleSelect mode

Product Supplier Dimensions Weight Price
<ui5-table mode="SingleSelect"></ui5-table>
	

Table in MultiSelect mode

Product Supplier Dimensions Weight Price
<ui5-table mode="MultiSelect"></ui5-table>
	

Table with No Data

Product Supplier Dimensions Weight Price
<ui5-table class="demo-table" no-data-text="No Data">
	<ui5-table-column slot="columns" style="width: 12rem">
		<span style="line-height: 1.4rem">Product</span>
	</ui5-table-column>

	<ui5-table-column slot="columns" min-width="800" popin-text="Supplier">
		<span style="line-height: 1.4rem">Supplier</span>
	</ui5-table-column>

	<ui5-table-column slot="columns" min-width="600" popin-text="Dimensions" demand-popin>
		<span style="line-height: 1.4rem">Dimensions</span>
	</ui5-table-column>

	<ui5-table-column slot="columns" min-width="600" popin-text="Weight" demand-popin>
		<span style="line-height: 1.4rem">Weight</span>
	</ui5-table-column>

	<ui5-table-column slot="columns">
		<span style="line-height: 1.4rem">Price</span>
	</ui5-table-column>
</ui5-table>
	

Growing Table with "More" button

Product Supplier
Dimensions
Weight Price
<ui5-table id="tbl" growing="Button" growing-button-subtext="[4 / 12]"></ui5-table>

<script>
	tbl.addEventListener("load-more", function() {
		rowsToLoad.forEach(() => {
			tbl.appendChild(document.createElement('ui5-table-row'));
		});
	});
</script>
	

Growing Table on Scroll

Product Supplier
Dimensions
Weight Price
<ui5-table id="myTblGrowsOnScroll" growing="Scroll"></ui5-table>
<script>
	myTblGrowsOnScroll.addEventListener("load-more", function() {
		busyIndicator.active = true;

		rowsToLoad.forEach(() => {
			tbl.appendChild(document.createElement('ui5-table-row'));
		});

		setTimeout(() => {
			busyIndicator.active = false;
		}, 500);
	});
</script>
	

Table with grouping (SingleSelect)

The ui5-table-group-row allows visual grouping of the table rows.
City Supplier Country Country: Bulgaria Sofia Company 1 Bulgaria Plovdiv Company 2 Bulgaria Country: USA Denver Company 3 USA Boston Company 4 USA
<ui5-table class="demo-table-single" mode="SingleSelect">
	<ui5-table-column id="column-1" slot="columns">
		<ui5-label>City</ui5-label>
	</ui5-table-column>
	<ui5-table-column id="column-2" slot="columns" min-width="500" popin-text="Supplier" demand-popin>
		<ui5-label>Supplier</ui5-label>
	</ui5-table-column>
	<ui5-table-column id="column-3" slot="columns" min-width="500">
		<ui5-label>Country</ui5-label>
	</ui5-table-column>

	<ui5-table-group-row>Country: Bulgaria</ui5-table-group-row>

	<ui5-table-row>
		<ui5-table-cell><span>Sofia</span></ui5-table-cell>
		<ui5-table-cell><span>Company 1</span></ui5-table-cell>
		<ui5-table-cell><span>Bulgaria</span></ui5-table-cell>
	</ui5-table-row>
	<ui5-table-row>
		<ui5-table-cell><span>Plovdiv</span></ui5-table-cell>
		<ui5-table-cell><span>Company 2</span></ui5-table-cell>
		<ui5-table-cell><span>Bulgaria</span></ui5-table-cell>
	</ui5-table-row>

	<ui5-table-group-row><span>Country: USA</span></ui5-table-group-row>

	<ui5-table-row>
		<ui5-table-cell><span>Denver</span></ui5-table-cell>
		<ui5-table-cell><span>Company 3</span></ui5-table-cell>
		<ui5-table-cell><span>USA</span></ui5-table-cell>
	</ui5-table-row>
	<ui5-table-row>
		<ui5-table-cell><span>Boston</span></ui5-table-cell>
		<ui5-table-cell><span>Company 4</span></ui5-table-cell>
		<ui5-table-cell><span>USA</span></ui5-table-cell>
	</ui5-table-row>
</ui5-table>
	

Tables with grouping (MultiSelect)

City Supplier Country Country: Bulgaria Sofia Company 1 Bulgaria Plovdiv Company 2 Bulgaria Country: USA Denver Company 3 USA Boston Company 4 USA
<ui5-table class="demo-table-multi" mode="MultiSelect">
	<ui5-table-column id="column-1" slot="columns">
		<ui5-label>City</ui5-label>
	</ui5-table-column>
	<ui5-table-column id="column-2" slot="columns" min-width="500" popin-text="Supplier" demand-popin>
		<ui5-label>Supplier</ui5-label>
	</ui5-table-column>
	<ui5-table-column id="column-3" slot="columns" min-width="500">
		<ui5-label>Country</ui5-label>
	</ui5-table-column>

	<ui5-table-group-row>Country: Bulgaria</ui5-table-group-row>

	<ui5-table-row>
		<ui5-table-cell><span>Sofia</span></ui5-table-cell>
		<ui5-table-cell><span>Company 1</span></ui5-table-cell>
		<ui5-table-cell><span>Bulgaria</span></ui5-table-cell>
	</ui5-table-row>
	<ui5-table-row>
		<ui5-table-cell><span>Plovdiv</span></ui5-table-cell>
		<ui5-table-cell><span>Company 2</span></ui5-table-cell>
		<ui5-table-cell><span>Bulgaria</span></ui5-table-cell>
	</ui5-table-row>

	<ui5-table-group-row><span>Country: USA</span></ui5-table-group-row>

	<ui5-table-row>
		<ui5-table-cell><span>Denver</span></ui5-table-cell>
		<ui5-table-cell><span>Company 3</span></ui5-table-cell>
		<ui5-table-cell><span>USA</span></ui5-table-cell>
	</ui5-table-row>
	<ui5-table-row>
		<ui5-table-cell><span>Boston</span></ui5-table-cell>
		<ui5-table-cell><span>Company 4</span></ui5-table-cell>
		<ui5-table-cell><span>USA</span></ui5-table-cell>
	</ui5-table-row>
</ui5-table>
	

Overview

The ui5-table component provides a set of sophisticated and convenient functions for responsive table design. It provides a comprehensive set of features for displaying and dealing with vast amounts of data.

To render the Table properly, the order of the columns should match with the order of the item cells in the rows.

Desktop and tablet devices are supported. On tablets, special consideration should be given to the number of visible columns and rows due to the limited performance of some devices.

Selection

To benefit from the selection mechanism of ui5-table component, you can use the available selection modes: SingleSelect and MultiSelect.
In additition to the used mode, you can also specify the ui5-table-row type choosing between Active or Inactive.

In SingleSelect mode, you can select both an Active and Inactive row via mouse or by pressing the Space or Enter keys.
In MultiSelect mode, you can select both an Active and Inactive row by pressing the Space key when a row is on focus or via mouse click over the selection checkbox of the row. In order to select all the available rows at once, you can use the selection checkbox presented in the table's header.

Note: Currently, when a column is shown as a pop-in, the visual indication for selection is not presented over it.

ES6 Module Import

import "@ui5/webcomponents/dist/Table.js";
import "@ui5/webcomponents/dist/TableColumn.js"; (for ui5-table-column)
import "@ui5/webcomponents/dist/TableRow.js"; (for ui5-table-row)
import "@ui5/webcomponents/dist/TableCell.js"; (for ui5-table-cell)

Properties/Attributes

You can use both properties and attributes with the same effect. The name of each attribute is listed below the name of the property, if different.

Name
Type
Default Value
Description
busy
boolean
false
Defines if the table is in busy state. In this state the component's opacity is reduced and busy indicator is displayed at the bottom of the table.
since v1.0.0-rc.12
busyDelay
busy-delay
Integer
1000
Defines the delay in milliseconds, after which the busy indicator will show up for this component.
growing
TableGrowingMode
"None"
Defines whether the table will have growing capability either by pressing a More button, or via user scroll. In both cases load-more event is fired.

Available options:

Button - Shows a More button at the bottom of the table, pressing of which triggers the load-more event.
Scroll - The load-more event is triggered when the user scrolls to the bottom of the table;
None (default) - The growing is off.

Limitations: growing="Scroll" is not supported for Internet Explorer, and the component will fallback to growing="Button".
since v1.0.0-rc.12
growingButtonSubtext
growing-button-subtext
string
""
Defines the subtext that will be displayed under the growingButtonText.

Note: This property takes effect if growing is set to Button.
since v1.0.0-rc.15
growingButtonText
growing-button-text
string
""
Defines the text that will be displayed inside the growing button at the bottom of the table, meant for loading more rows upon press.

Note: If not specified a built-in text will be displayed.
Note: This property takes effect if growing is set to Button.
since v1.0.0-rc.15
hideNoData
hide-no-data
boolean
false
Defines if the value of noDataText will be diplayed when there is no rows present in the table.
since v1.0.0-rc.15
mode
TableMode
"None"
Defines the mode of the component.

Available options are:
  • MultiSelect
  • SingleSelect
  • None
    • since v1.0.0-rc.15
noDataText
no-data-text
string
""
Defines the text that will be displayed when there is no data and hideNoData is not present.
stickyColumnHeader
sticky-column-header
boolean
false
Determines whether the column headers remain fixed at the top of the page during vertical scrolling as long as the Web Component is in the viewport.

Limitations:
  • Browsers that do not support this feature:
    • Internet Explorer
    • Microsoft Edge lower than version 41 (EdgeHTML 16)
    • Mozilla Firefox lower than version 59
  • Scrolling behavior:
    • If the Web Component is placed in layout containers that have the overflow: hidden or overflow: auto style definition, this can prevent the sticky elements of the Web Component from becoming fixed at the top of the viewport.

Slots

This Element provides slot(s). This means it can display its child nodes.
Unless targeting the default slot, use the slot attribute to define the destination slot for each child.
Text, along with HTML Elements with no slot attribute, goes the the default slot.

Slot
Type
Description
columns
HTMLElement [0..n]
Defines the configuration for the columns of the component.

Note: Use ui5-table-column for the intended design.
default
HTMLElement [0..n]
Defines the component rows.

Note: Use ui5-table-row for the intended design.

Events

This Web Component fires semantic events upon user interaction. You can bind to these events with the standard DOM APIs, such as addEventListener.

Name
Description
load-more
Fired when the user presses the More button or scrolls to the table's end.

Note: The event will be fired if growing is set to Button or Scroll.
since v1.0.0-rc.11
popin-change
Fired when ui5-table-column is shown as a pop-in instead of hiding it.
since v1.0.0-rc.6
poppedColumns
type: Array
description: popped-in columns.
row-click
Fired when a row in Active mode is clicked or Enter key is pressed.
row
type: HTMLElement
description: the activated row.
selection-change
Fired when selection is changed by user interaction in SingleSelect and MultiSelect modes.
since v1.0.0-rc.15
selectedRows
type: Array
description: An array of the selected rows.
previouslySelectedRows
type: Array
description: An array of the previously selected rows.

TableColumn

Overview

The ui5-table-column component allows to define column specific properties that are applied when rendering the ui5-table component.

CSS Shadow Parts

CSS Shadow Parts allow developers to style elements inside the Shadow DOM.
The ui5-table-column exposes the following CSS Shadow Parts:
  • column - Used to style the native th element

Properties/Attributes

You can use both properties and attributes with the same effect. The name of each attribute is listed below the name of the property, if different.

Name
Type
Default Value
Description
demandPopin
demand-popin
boolean
false
According to your minWidth settings, the component can be hidden in different screen sizes.

Setting this property to true, shows this column as pop-in instead of hiding it.
minWidth
min-width
Integer
Infinity
Defines the minimum table width required to display this column. By default it is always displayed.

The responsive behavior of the ui5-table is determined by this property. As an example, by setting minWidth property to 400 sets the minimum width to 400 pixels, and shows this column on tablet (and desktop) but hides it on mobile.
For further responsive design options, see demandPopin property.
popinText
popin-text
string
""
The text for the column when it pops in.

Slots

This Element provides slot(s). This means it can display its child nodes.
Unless targeting the default slot, use the slot attribute to define the destination slot for each child.
Text, along with HTML Elements with no slot attribute, goes the the default slot.

Slot
Type
Description
default
Node [0..n]
Defines the content of the column header.

TableRow

Overview

The ui5-table-row component represents a row in the ui5-table.

CSS Shadow Parts

CSS Shadow Parts allow developers to style elements inside the Shadow DOM.
The ui5-table-row exposes the following CSS Shadow Parts:
  • row - Used to style the native tr element
  • popin-row - Used to style the tr element when a row pops in

Properties/Attributes

You can use both properties and attributes with the same effect. The name of each attribute is listed below the name of the property, if different.

Name
Type
Default Value
Description
selected
boolean
false
Defines the row's selected state.
since v1.0.0-rc.15
type
TableRowType
"Inactive"
Defines the visual indication and behavior of the component.

Available options are:
  • Active
  • Inactive


Note: When set to Active, the item will provide visual response upon press, while with type Inactive - will not.
since v1.0.0-rc.15

Slots

This Element provides slot(s). This means it can display its child nodes.
Unless targeting the default slot, use the slot attribute to define the destination slot for each child.
Text, along with HTML Elements with no slot attribute, goes the the default slot.

Slot
Type
Description
default
sap.ui.webcomponents.main.ITableCell [0..n]
Defines the cells of the component.

Note: Use ui5-table-cell for the intended design.

TableGroupRow

Overview

The ui5-table-group-row component represents a group row in the ui5-table.

CSS Shadow Parts

CSS Shadow Parts allow developers to style elements inside the Shadow DOM.
The ui5-table-group-row exposes the following CSS Shadow Parts:
  • group-row - Used to style the native tr element.

Slots

This Element provides slot(s). This means it can display its child nodes.
Unless targeting the default slot, use the slot attribute to define the destination slot for each child.
Text, along with HTML Elements with no slot attribute, goes the the default slot.

Slot
Type
Description
default
Node [0..n]
Defines the text of the component.
Note: Although this slot accepts HTML Elements, it is strongly recommended that you only use text in order to preserve the intended design.

TableCell

Overview

The ui5-table-cell component defines the structure of the data in a single ui5-table cell.

CSS Shadow Parts

CSS Shadow Parts allow developers to style elements inside the Shadow DOM.
The ui5-table-cell exposes the following CSS Shadow Parts:
  • cell - Used to style the native td element

Slots

This Element provides slot(s). This means it can display its child nodes.
Unless targeting the default slot, use the slot attribute to define the destination slot for each child.
Text, along with HTML Elements with no slot attribute, goes the the default slot.

Slot
Type
Description
default
Node [0..n]
Specifies the content of the component.
Theme: Quartz Light Quartz Dark Quartz High Contrast Black Quartz High Contrast White Belize High Contrast Black High Contrast White Horizon
Content Density: Cozy Compact
Text Direction: LTR RTL
Apply Cancel