Across every breakpoint, use .table-responsive for horizontally scrolling tables. Use
.table-responsive{-sm|-md|-lg|-xl|-xxl} as needed to create responsive tables up to a particular
breakpoint.
Information should be organised in a meaningful way, such as hierarchy or in alphabetical order.
Tables should allow user interaction so that a data display is customisable and interactive.
Tables should be easy to use, with a logical structure that makes content easy to understand.
Table total page count usually reduce after filter data, which by default return to first page in case current page is out of filtered results.
Table should be used when:
You want to show tabular information, such as statistics.
Displaying directories where content of similar nature and structure are grouped together.
Users are required to sort, search, paginate and filter data.
Table should not be used when:
There is complex data visualisation, you may want to use inforgraphics or bars and charts.
Usability guidelines
Keep tables simple
Tables are useful when displaying data and complex information. Try to use minimal visual styling to surface
information easily.
Consider mobile applications
As table rows can be long in nature, do consider if your content requires to be in a table.
Enable sorting
Do enable sorting where applicable as this will help users move through content within the table.
Behaviour
Row hover - row displays a background colour when user hovers over a row
Column hover - if sorting is enabled, an arrow icon can appear next to the column header.
Accessibility guidelines
Aria attributes
If there is an element in the user interface that serves as a label for the table, aria-labelledby is set on the table element with a value that refers to the labelling element. Otherwise, a label is specified for the table element using aria-label.
If the table has a caption or description, <ßcode>aria-describedby is set on the table element with a value referring to the element containing the description.
Keyboard accessibility
If the table is purely informational and has no interactive elements, it does not need to be keyboard focusable or operable. If there are interactive elements such as text links or sorting arrows, users should be able to navigate using standard keyboard controls.
Focus indicator
Ensure that any interactive element within the table is highly visible and distinct, making it stand out against the rest of the table content.
When an interactive element in the table is focused, provide a clear visual indication of focus.