ns-tabledisplays information in a grid-like format of rows and columns. It organizes information in a way that’s easy to scan, so that users can look for patterns and insights.
The table component consumes basic HTML table markup, which makes it accessible and responsive as well as styling it.
Use to provide context to the table content. The recommended length is between 4 and 12 words, not exceeding 50 characters in total.
A short description of the data or information found in the column cells below.
Fixable Row Headings
This column can be used for data or information. It can also be set to a fixed column of headings for each row.
This should contain the data or information required for each relevant column and row.
Use ns-table just for layout
Use for displaying data in tables
Use for laying out components
Use basic text, numbers
Use tables for anything but tabular data
Include at least one column header or row header
Keep column and row headers short and concise
Structure them in a logical and expected way
Not all tables necessarily need captions, but it's recommended you provide one.
Column header names should describe the type of content displayed in each column. Each row should contain data related to a single entity.
Think about the experience on a smaller screen size.
ns-table component adds all the necessary Aria tags to the table to make it accessible for screen readers.
Keyboard controls are automatically added to the table to make it perform as a data grid. You can select cells and use the arrow keys to navigate.
If your table has table headers in the first column, the component will make these “sticky” so that the table data can be scrolled horizontally whilst the first column headers stay in place.
To see examples visit Storybook.
<ns-table><table><caption> ... </caption><thead> ... </thead><tbody> ... </tbody><tfoot> ... </tfoot></table></ns-table>
Does it live in a panel?
Does it live inside other components?
What layout classes can be used?
ns-table doesn't expect any attributes to be added to it, you simply need to insert HTML table markup and it will render the table in an accessible and responsive way.
Be sure to add a
<caption> tag inside the
<table>. The caption should explain what the table is representing.
<table><caption>European countries in order of population</caption></table>
If your table data has column headings across the first row then place header cells (
<th>) within the
If your table has row headers in the left-most column then place these headers in
<th> within the
<tbody>. The component will automatically make these headings 'sticky' so that on smaller screens you can scroll the table horizontally while the row headers stay in place.
<table><thead><tr><th> </th><th>Month 1</th><th>Month 2</th>...<th>Month 11</th><th>Month 12</th></tr></thead><tbody><tr><th>Company A<th><td>100</td><td>200</td>...<td>1100</td><td>1200</td></tr><tr><th>Company B<th><td>100</td><td>200</td>...<td>1100</td><td>1200</td></tr></tbody></table>
Do you have insights or concerns to share? You can raise an issue via Github bugs.
See all the issues already raised via Github issues.
💩 🎉 🦄 You can also contact the team on Slack on the