Table (code)
A table is used to organise and display tabular data in a way that's easy to scan.
Props
System Props
System Props
Next to the properties listed in the propstable, a collection of system props can be added to any component for further general styling and layouting purposes. These props vary per component.
To read more about the system, click here to check out its dedicated page.
Columns
defines the upper row of the table and tells the table rows where to find the necessary data.
This is an array of objects, one for each column. The structure of that object is as follows:
- (required): The text that will be used in the table's header.
- (required): The key that corresponds to a key in the array's objects.
- (optional): How the column's text should be aligned.
Data
Based on the fields defined in the prop, the object should be an array that has objects with keys corresponing to the keys you defined.
If a key would not exist on a row, a character will be shown.
Empty table
If the property is either not defined or an empty array, the table will show as empty. You can customize the empty display by using and .
TableLayout
Defines the algorithm used to lay out table cells, rows, and columns.
Column width
Sets the width of the column. If you want to be sure to have a fixed width, use tableLayout fixed.
Ellipsis
If a collumn has ellipsis, overflowing texts will be cut and ellipsis will be added.
Sorting
The has a basic sorting feature that lets users sort data by any column. To make it possible, set the property to .
Non sorting columns
Make specific columns non-sortable by adding a key to . In the example below the Name field is set to .
Component sorting not supported
The default sorting method is only limited to non component data and will cause errors when it tries to sort columns with components.That's why we recommend giving that specific column a key.
Custom sorting
It's also possible to pass a algorithm to specific columns. In the example below the new algorithm sorts by length of string of birthpllace.