Skip to main content

Table

Tables do not yet exist as a component of the library, because tables as HTML elements are quite primitive, and it is in their presentation or implementation details that one table can be differentiated from another.

The consideration of a table library with its own APIs to handle pagination, sorting, filtering, rearrangements and other features is being weighed for inclusion in the component library in the future; however, there is no currently available timeline for when this will happen, and it is not under active development at this time.

Be aware that any data intended to be displayed within a table, with additional functionality such as pagination, sorting and filtering etc., will require logic to be implemented for each particular scenario; the library cannot handle this automatically. As an example:

  • ● A sort function needs to have knowledge of which values to compare for sorting, and the same is true for filtering.
  • ● For pagination, a decision must be made about where the pagination is carried out, ideally in the back-end (BE), and then just displayed in the front-end (FE).

If these features are essential for your situation, you may choose to implement the required functionality; as it will need to be created anyway, the library API could simply sort based on your sorting algorithm and provide a sorted copy of the original set of data to a standard table element, as a quick way to get the desired result in the interim.

How do I implement a table component?

The following example outlines how to implement a basic table component using existing components from the component library, such as the DropdownMenu component. Styling by TailwindCSS is automatically applied so you can easily ensure that your table component looks consistent with the rest of the designs.

If you would like to add a shadow to your table component, use the shadow-md class for the wrapping container.

Live Editor
Result