Skip to content

Tables ​

Usage ​

  • The number of <th> elements should match the number of <td> elements in a row to ensure proper alignment, spacing, and styling of the table heading's bottom border. This is an alignment requirement, not a constraint on what a column may represent — a column can be a repeated entity (one per household member, location, or month) rather than a fixed data field. See matrix tables.
  • Action items such as edit or delete should appear as icon links with a descriptive table heading.
  • For rows that expand to show the detail behind a summary (master-detail, e.g. change history), use EnTableRowDetail rather than hand-rolling a show/hide row.
  • Individual cells and table headings should typically be left aligned, the exception being currencies, or other numbers that align better from the right, and columns with fixed-width content — such as an edit icon with an "Edit" heading — which are usually center aligned, especially at the end of the table columns. Table headers should typically match the alignment of the content in the column. In the Vue table components this is declared per column: set class on the heading object (applied to both the header and the column's cells) with the text-right or text-center utility — see the column alignment example on EnTableBasic (works on EnTableSortable too).

Class Modifiers & Utilities ​

table-striped adds a light gray background to every other table row. This class can be used for larger tables to make rows easier to read.

table-responsive is a wrapper class for tables which has a max-width set to 100% and overflow-x set to auto. This adds a scrollbar to the bottom of the table's container to allow scrolling vs. the table overflowing the container.

table-sticky makes the table headers stick to the top of a scrollable container as the table is scrolled. Works well with scroll-container CSS class.

text-nowrap prevents text wrapping to a second line. This can make a table look cleaner, however it will likely increase the widths of larger tables and should probably be used with the table-responsive utility. It can be applied to the entire table, or — like the alignment utilities — to a single column via the heading object's class (or just the header via headerClass) when only certain headers or columns should not wrap.

text-wrap forces long or unbroken content (word-break: break-word) to wrap instead of stretching its column. Apply it the same ways — to the table, a column, or a header.

text-smaller can be applied to the entire table to decrease the font-size on larger tables, allowing it to fit more within the viewing area.

text-right right-aligns text — apply it to a column (header and cells together) for currencies and other numeric data so values align from the right and decimal points line up.

text-center center-aligns text — apply it to a column whose content is a fixed width, such as an icon action column (Edit, Delete), especially when it is the last column of the table.

table-panel styles a table that fills a panel — the rate grids and contribution tables where most cells hold a control rather than text. It shades the header row and sets it in small uppercase, divides rows with a bottom border rather than a top one so the header owns its own rule, centers cells vertically so they sit with their inputs, and drops the trailing rule on the last row because the panel's own edge already closes the table. Use it only inside a panel; a standalone table should keep the base style. Benefits theme only.

table-fixed pins the column widths (table-layout: fixed, width: 100%) so they stop responding to cell content. Reach for it when one cell's content would otherwise stretch its column and reflow the rest of the table — most often a cell spanning several columns, such as a disclaimer row (see Spanning a row across columns). Column widths are then taken from the first row, so set widths on the headings if you need specific proportions. Benefits theme only — the employee stylesheet does not carry this modifier.

Panel table ​