Table

Data tables with typed columns. Supports clickable rows, empty state, horizontal scroll, and vertical scroll with sticky header.

InputTypeDefaultDescription
columnsNgOatTableColumn[]requiredColumn definitions
dataRecord<string, any>[]requiredRow data
clickablebooleanfalseEnable row click styling
emptyTextstring'No data available.'Text shown when data is empty
scrollXbooleanfalseEnable horizontal scroll — table overflows horizontally on small screens
scrollYstring'' Enable vertical scroll with a sticky header. Pass any CSS length: '300px', '50vh'
OutputTypeDescription
rowClickRecord<string, any>Emitted when a row is clicked

Import & Usage

typescript
import { Component } from '@angular/core';
import { NgOatTable, type NgOatTableColumn } from '@letsprogram/ng-oat';

@Component({
  selector: 'app-example',
  imports: [NgOatTable],
  template: `
    <ng-oat-table
      [columns]="columns"
      [data]="users"
      [scrollX]="true"
      [clickable]="true"
      (rowClick)="onRowClick($event)" />
  `,
})
export class ExampleComponent {
  columns: NgOatTableColumn[] = [
    { key: 'name', label: 'Name' },
    { key: 'role', label: 'Role' },
  ];
  users = [
    { name: 'Alice', role: 'Engineer' },
    { name: 'Bob', role: 'Designer' },
  ];
  onRowClick(row: any) {
    console.log('Clicked:', row);
  }
}

Basic Table

NameRoleStatus
AliceEngineerActive
BobDesignerAway
CarolPMActive
DaveQAActive
html
<ng-oat-table
  [columns]="[
    { key: 'name', label: 'Name' },
    { key: 'role', label: 'Role' },
    { key: 'status', label: 'Status' }
  ]"
  [data]="users"
  [scrollX]="true" />

Clickable Rows

NameRoleStatus
AliceEngineerActive
BobDesignerAway
CarolPMActive
DaveQAActive
html
<ng-oat-table
  [columns]="columns"
  [data]="users"
  [scrollX]="true"
  [clickable]="true"
  (rowClick)="onRowClick($event)" />

Horizontal Scroll

Use [scrollX]="true" so wide tables stay within the layout and scroll horizontally on small screens instead of overflowing.

Full NameEmailRoleDepartmentLocationDate JoinedStatus
Alice Johnsonalice@example.comEngineerPlatformNew York2021-03-15Active
Bob Martinezbob@example.comDesignerProductAustin2022-07-01Away
Carol Singhcarol@example.comPMOperationsLondon2020-11-22Active
Dave Kimdave@example.comQAQualityToronto2023-01-10Active
html
<ng-oat-table
  [columns]="wideColumns"
  [data]="wideData"
  [scrollX]="true" />

Vertical Scroll + Sticky Header

Use [scrollY]="'260px'" to cap the table height. The header row stays fixed while the body scrolls.

NameRoleStatus
AliceEngineerActive
BobDesignerAway
CarolPMActive
DaveQAActive
EveDevOpsAway
FrankEngineerActive
GraceDesignerActive
HankQAAway
IrisPMActive
JackEngineerActive
KarenDevOpsAway
LeoDesignerActive
html
<ng-oat-table
  [columns]="columns"
  [data]="manyUsers"
  [scrollX]="true"
  scrollY="260px" />

Empty State

NameRoleStatus
No users found. Try adjusting your filters.
html
<ng-oat-table
  [columns]="columns"
  [data]="[]"
  [scrollX]="true"
  emptyText="No users found." />

Product Inventory

ProductPriceIn StockCategory
Wireless Keyboard$49.99142Electronics
USB-C Hub$29.9958Accessories
Monitor Stand$79.9923Furniture
html
<ng-oat-table
  [columns]="[
    { key: 'name', label: 'Product', width: '40%' },
    { key: 'price', label: 'Price' },
    { key: 'stock', label: 'In Stock' },
    { key: 'category', label: 'Category' }
  ]"
  [data]="products"
  [scrollX]="true" />