Skip to content

Table Styles

Provides fully-featured table styles with configurable colors, row behaviors, hover effects, sorting, expandable rows, and alignment utilities.

NameAgeEmail
John Doe20john@example.com
Jane Smith25jane.smith@example.com
Jack Ma39jack.ma@example.com
Lorem ipsum dolor sit amet consectetur adipiscing elit quisque faucibus ex sapien vitae pellentesque sem placerat in id cursus mi. 44jack.ma@example.com
NameAgeEmail
John Doe20john@example.com
Jane Smith25jane.smith@example.com
Jack Ma39jack.ma@example.com
Lorem ipsum dolor sit amet consectetur adipiscing elit quisque faucibus ex sapien vitae pellentesque sem placerat in id cursus mi. 44jack.ma@example.com

Usage

Signature:

scss
@mixin use-table($colors: ());

Example:

scss
// Apply all registered color variants
@include termeh.use-table();

// Apply only specific color variants
@include termeh.use-table(("primary", "error"));
Dependencies

Table module uses the following Termeh global var():

ComponentTypeUsageDefault
basecolorColorFallback base table backgroundwhite
basesectionColorFallback background for even rows and row hovernull
baseseparatorColorFallback color for table separators and dividersnull
strongweightStringFallback font weight for headersbold
tablebackgroundColorMain table backgroundFALLBACK
tableforegroundColorDefault table text colornull
tableevenColorEven row backgroundFALLBACK
tablehoverColorHover row backgroundFALLBACK
tablegridColorGrid line colornull
tabledividerColorSection divider colorFALLBACK
tableseparatorColorRow separator colorFALLBACK
tabledecoratorColorSort decorator colorerror
tablesort-backgroundColorSorted column backgroundFALLBACK
tablestrong-weightStringStrong font weight for headersFALLBACK

Table module uses the following Termeh color() and variant():

Color / VariantUsageDefault
primaryAccent color for scrollbarserror
shadeFallback color for sort backgrounds and decoratorserror

Table Container

You can wrap your table inside .table-container to enable scrolling on overflow.

Modifiers

  • .is-fullwidth → makes the table span 100% width
  • .is-stripped → applies alternating background to even rows
  • .is-hoverable → highlights rows on hover
  • .is-<color> → applies a registered color as accent color

Child Elements

  • <thead> → include header rows
    • <tr> → define a header row
      • <th> → define a header column
  • <tbody> → include table content
    • <tr> → define a body row
      • <td> → define a body column
  • <tfoot> → include table footer and summary
    • <tr> → define a footer row
      • <td> → define a footer column

Header Modifiers

  • .is-center-aligned → centers text inside column
  • .is-right-aligned → right-aligns text inside column
  • .is-left-aligned → left-aligns text inside column
  • .is-ellipsis → truncates overflowing text in column with ellipsis
  • .is-filler → expands column to fill remaining space
  • .is-sortable → makes a column sortable
  • .is-sorted → marks a column as sorted
  • .is-asc → marks sorted column as ascending
  • .is-desc → marks sorted column as descending
  • ROW

    • .is-even → applies alternate background to even rows
    • .extra → marks row as extra content for the previous row
    • .is-expanded → shows the next .extra row
  • COLUMN

    • .is-center-aligned → centers text inside column
    • .is-right-aligned → right-aligns text inside column
    • .is-left-aligned → left-aligns text inside column
    • .is-ellipsis → truncates overflowing text in column with ellipsis
    • .is-filler → expands column to fill remaining space
    • .is-multiline → allows multi-line text inside column
    • .is-sorted → marks a column as sorted