Table

Apply responsive styles to a native HTML table.

A list of your recent invoices.
InvoiceStatusMethodAmount
INV001PaidCredit Card$250.00
INV002PendingPayPal$150.00
INV003UnpaidBank Transfer$350.00
INV004PaidCredit Card$450.00
INV005PaidPayPal$550.00
INV006PendingBank Transfer$200.00
INV007UnpaidCredit Card$300.00
Total$2,500.00

Installation

ng g @spartan-ng/cli:ui table

Usage

import { HlmTableImports } from '@spartan-ng/helm/table';
<div hlmTableContainer>
  <table hlmTable>
    <caption hlmTableCaption>
      A list of your recent invoices.
    </caption>
    <thead hlmTableHeader>
      <tr hlmTableRow>
        <th hlmTableHead class="w-[100px]">Invoice</th>
        <th hlmTableHead>Status</th>
        <th hlmTableHead>Method</th>
        <th hlmTableHead class="text-right">Amount</th>
      </tr>
    </thead>
    <tbody hlmTableBody>
      @for (invoice of _invoices; track invoice.invoice) {
      <tr hlmTableRow>
        <td hlmTableCell class="font-medium">{{ invoice.invoice }}</td>
        <td hlmTableCell>{{ invoice.paymentStatus }}</td>
        <td hlmTableCell>{{ invoice.paymentMethod }}</td>
        <td hlmTableCell class="text-right">{{ invoice.totalAmount }}</td>
      </tr>
      }
    </tbody>
    <tfoot hlmTableFooter>
      <tr hlmTableRow>
        <td hlmTableCell [attr.colSpan]="3">Total</td>
        <td hlmTableCell class="text-right">$2,500.00</td>
      </tr>
    </tfoot>
  </table>
</div>

Examples

Use <tfoot hlmTableFooter> to add a footer to the table.

A list of your recent invoices.
InvoiceStatusMethodAmount
INV001PaidCredit Card$250.00
INV002PendingPayPal$150.00
INV003UnpaidBank Transfer$350.00
Total$2,500.00

Actions

A table showing actions for each row using a Dropdown component.

ProductPriceActions
Wireless Mouse$29.99
Mechanical Keyboard$129.99
USB-C Hub$49.99

Data Table

For more complex tables, have a look at the data table , which is powered by the incredible work of TanStack-Table .

See the Data Table documentation for more information.

You can also see an example of a data table in the Tasks demo.

RTL

To enable RTL support in spartan-ng, see the RTL configuration guide.

قائمة بفواتيرك الأخيرة.
الفاتورةالحالةالطريقةالمبلغ
INV001مدفوعبطاقة ائتمانية$250.00
INV002قيد الانتظارPayPal$150.00
INV003غير مدفوعتحويل بنكي$350.00
INV004مدفوعبطاقة ائتمانية$450.00
INV005مدفوعPayPal$550.00
INV006قيد الانتظارتحويل بنكي$200.00
INV007غير مدفوعبطاقة ائتمانية$300.00
المجموع$2,500.00

Helm API

HlmTableContainer

Selector: div[hlmTableContainer]

HlmTable

Selector: table[hlmTable]

Inputs

PropTypeDefaultDescription
hlmTable Partial<HlmTableVariant> | string {} Input to configure the variant of the table, this input has the highest priority.

HlmTHead

Selector: thead[hlmTHead],thead[hlmTableHeader]

HlmTBody

Selector: tbody[hlmTBody],tbody[hlmTableBody]

HlmTFoot

Selector: tfoot[hlmTFoot],tfoot[hlmTableFooter]

HlmTr

Selector: tr[hlmTr],tr[hlmTableRow]

HlmTh

Selector: th[hlmTh],th[hlmTableHead]

HlmTd

Selector: td[hlmTd],td[hlmTableCell]

HlmCaption

Selector: caption[hlmCaption],caption[hlmTableCaption]

Tabs Switch