Spartans get ready! v1 is coming!
We are very close to our first stable release. Expect more announcements in the coming weeks. v1 was made possible by our partner Zerops.
Getting Started
Stack
Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Dropdown Menu
- Empty
- Field
- Form Field
- Hover Card
- Icon
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Label
- Menubar
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner (Toast)
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Tooltip
Table
Apply responsive styles to a native HTML table.
| Invoice | Status | Method | Amount |
|---|---|---|---|
| INV001 | Paid | Credit Card | $250.00 |
| INV002 | Pending | PayPal | $150.00 |
| INV003 | Unpaid | Bank Transfer | $350.00 |
| INV004 | Paid | Credit Card | $450.00 |
| INV005 | Paid | PayPal | $550.00 |
| INV006 | Pending | Bank Transfer | $200.00 |
| INV007 | Unpaid | Credit Card | $300.00 |
| Total | $2,500.00 | ||
import { Component } from '@angular/core';
import { HlmTableImports } from '@spartan-ng/helm/table';
@Component({
selector: 'spartan-table-preview',
imports: [HlmTableImports],
host: {
class: 'w-full',
},
template: `
<div hlmTableContainer>
<table hlmTable>
<caption hlmCaption>A list of your recent invoices.</caption>
<thead hlmTHead>
<tr hlmTr>
<th hlmTh class="w-[100px]">Invoice</th>
<th hlmTh>Status</th>
<th hlmTh>Method</th>
<th hlmTh class="text-right">Amount</th>
</tr>
</thead>
<tbody hlmTBody>
@for (invoice of _invoices; track invoice.invoice) {
<tr hlmTr>
<td hlmTd class="font-medium">{{ invoice.invoice }}</td>
<td hlmTd>{{ invoice.paymentStatus }}</td>
<td hlmTd>{{ invoice.paymentMethod }}</td>
<td hlmTd class="text-right">{{ invoice.totalAmount }}</td>
</tr>
}
</tbody>
<tfoot hlmTFoot>
<tr hlmTr>
<td hlmTd [attr.colSpan]="3">Total</td>
<td hlmTd class="text-right">$2,500.00</td>
</tr>
</tfoot>
</table>
</div>
`,
})
export class TablePreview {
protected _invoices = [
{
invoice: 'INV001',
paymentStatus: 'Paid',
totalAmount: '$250.00',
paymentMethod: 'Credit Card',
},
{
invoice: 'INV002',
paymentStatus: 'Pending',
totalAmount: '$150.00',
paymentMethod: 'PayPal',
},
{
invoice: 'INV003',
paymentStatus: 'Unpaid',
totalAmount: '$350.00',
paymentMethod: 'Bank Transfer',
},
{
invoice: 'INV004',
paymentStatus: 'Paid',
totalAmount: '$450.00',
paymentMethod: 'Credit Card',
},
{
invoice: 'INV005',
paymentStatus: 'Paid',
totalAmount: '$550.00',
paymentMethod: 'PayPal',
},
{
invoice: 'INV006',
paymentStatus: 'Pending',
totalAmount: '$200.00',
paymentMethod: 'Bank Transfer',
},
{
invoice: 'INV007',
paymentStatus: 'Unpaid',
totalAmount: '$300.00',
paymentMethod: 'Credit Card',
},
];
}Installation
npx nx g @spartan-ng/cli:ui table
ng g @spartan-ng/cli:ui table
Usage
import { HlmTableImports } from '@spartan-ng/helm/table';<div hlmTableContainer>
<table hlmTable>
<caption hlmCaption>
A list of your recent invoices.
</caption>
<thead hlmTHead>
<tr hlmTr>
<th hlmTh class="w-[100px]">Invoice</th>
<th hlmTh>Status</th>
<th hlmTh>Method</th>
<th hlmTh class="text-right">Amount</th>
</tr>
</thead>
<tbody hlmTBody>
@for (invoice of _invoices; track invoice.invoice) {
<tr hlmTr>
<td hlmTd class="font-medium">{{ invoice.invoice }}</td>
<td hlmTd>{{ invoice.paymentStatus }}</td>
<td hlmTd>{{ invoice.paymentMethod }}</td>
<td hlmTd class="text-right">{{ invoice.totalAmount }}</td>
</tr>
}
</tbody>
<tfoot hlmTFoot>
<tr hlmTr>
<td hlmTd [attr.colSpan]="3">Total</td>
<td hlmTd class="text-right">$2,500.00</td>
</tr>
</tfoot>
</table>
</div>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.
Helm API
HlmTableContainer
Selector: div[hlmTableContainer]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |
HlmTable
Selector: table[hlmTable]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| hlmTable | Partial<HlmTableVariant> | string | {} | Input to configure the variant of the table, this input has the highest priority. |
| class | ClassValue | - | - |
HlmTHead
Selector: thead[hlmTHead]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |
HlmTBody
Selector: tbody[hlmTBody]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |
HlmTFoot
Selector: tfoot[hlmTFoot]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |
HlmTr
Selector: tr[hlmTr]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |
HlmTh
Selector: th[hlmTh]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |
HlmTd
Selector: td[hlmTd]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |
HlmCaption
Selector: caption[hlmCaption]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |