Angular Data Table & Lists | ng-hub-ui-paginable
Angular data table and paginated list with server-side pagination, sorting, filtering, selection, templates and CSS variables.
API reference
Here's the full contract for paginable: everything you can bind, listen to, project and theme, gathered in one place. Wire up what you need and style what you want — it's standalone and signal-friendly.
Inputs
Dial paginable in with 74 inputs. Bind them like any Angular @Input.
| Name | Type | Default | Description |
|---|---|---|---|
id | string | — | Identifier of this table instance. Defaults to a generated unique id, so two tables on the same page never share one. |
data | T[] | PaginationState<T> | null | — | Table data, bound with the `data` alias. Pass a plain array to let the table paginate/filter/sort in memory (client mode, when `paginate` is true and `totalItems` is unset); pass a `PaginationState` for server mode (the table renders it as-is and reads `page`/`perPage`/`totalItems` from it). |
resource | HubPaginableResource<T> | null | — | A signal-based resource — `resource()`, `httpResource()` or anything with the same three signals — bound whole. Its value is read exactly as `data` is (array or `PaginationState`), `isLoading()` drives the loading state and `error()` the error state. Bound alongside `data` the resource wins, and changing page never calls `reload()`: whoever owns the request keeps owning it. |
headers | (PaginableTableHeader | string)[] | — | Column definitions. A string is shorthand for `{ property, title }`; a `PaginableTableHeader` enables sorting, per-column filters, buttons, sticky/visibility, alignment, templates and widths (`width`, `minWidth`, `maxWidth`, `resizable`). Two-way bindable (`model`): a finished column resize writes the new width back. |
page | number | null | — | Current 1-based page. Two-way bindable (`model`) — emits `pageChange`. Defaults to `null`. |
perPage | number | null | — | Items per page. Two-way bindable (`model`) — emits `perPageChange`. Defaults to `10`. |
perPageOptions | number[] | — | Selectable page sizes shown in the per-page selector. Defaults to `[10, 20, 50, 100]`. |
totalItems | number | null | — | Total number of items across all pages (server mode). Setting it keeps the table in server mode even for a plain array. Two-way bindable (`model`) — emits `totalItemsChange`. |
paginate | boolean | — | Enables pagination. When `true` (default) with a plain array and no `totalItems`, the table searches, filters, sorts and slices in memory (client mode). Set `false` to render the whole array without pagination. |
ordination | PaginableTableOrdination | — | Active sort (`{ property, direction }`). Two-way bindable (`model`) — emits `ordinationChange` when a sortable header is clicked. |
searchable | boolean | — | Shows the global search box. Defaults to `true`. |
searchTerm | string | — | Global search term. Two-way bindable (`model`) — emits `searchTermChange` (debounced by `debounce`). |
searchFn | (item: T, term: string) => boolean | — | Decides row by row what survives the global search, instead of scanning the searchable columns — which is how you match on a field no column shows. Consulted in client mode only; the term arrives already trimmed and lowercased, the same contract hub-list honours. |
compareFn | (a: T, b: T) => boolean | — | Decides when two selection values are the same record, everywhere the table matches the selection against the rows. It receives what the selection stores: the row data, or the `bindValue` property when one is set. Unbound, the matching is what it always was. |
filters | Record<string, unknown> | null | — | Per-column filter values keyed by `filter.key` or `property`. Two-way bindable (`model`) — emits `filtersChange`. |
selectable | SelectionTypes | boolean | null | — | Enables row selection (`true`/`single` draws a radio per row, `multiple` a checkbox). The selected value is read/written through `ControlValueAccessor` (`[(ngModel)]` or a `formControl`). |
multiple | boolean | — | Forces multiple selection regardless of `selectable`. Defaults to `false`. |
selectWhileSelecting | boolean | — | While at least one row is selected, a click (or Enter/Space on a focused row) marks it instead of running `clickFn`. Off by default: on a pointer a click keeps the meaning the consumer gave it. The mode holds no state — it starts with the first row ticked and ends with the last one unticked. It is a pointer shortcut only: the keyboard marks a row through the checkbox the row itself draws, which is a tab stop already, so the row itself takes focus only when `clickFn` makes it a control in its own right. |
bindValue | string | — | Property of each row used as the selection value instead of the whole object. |
clickFn | (event: TableRowEvent<T>) => void | Promise<void> | — | Callback invoked when a row is clicked, receiving the row data plus the originating event. |
rowClass | string | ((item: T) => string) | — | CSS class applied to every row, either a fixed string or a function of the row data. |
responsive | TableBreakpoint | null | — | Breakpoint at which the table switches to its responsive (stacked) layout. |
paginationPosition | 'bottom' | 'top' | 'both' | — | Where the pagination bar is drawn: `bottom` under the rows, `top` above them, `both` in each place. The whole bar moves — paginator, page-size selector and row count — and each one carries a `hub-table__bottom-bar--top` or `--bottom` modifier. Defaults to `bottom`. |
paginationInfo | boolean | — | Shows the "Showing X of Y" info line. Defaults to `true`. |
stickyActions | boolean | — | Keeps the row action column stuck to the viewport while scrolling. Defaults to `false`. |
stickyHeader | boolean | — | Pins the header (`position: sticky; top: 0`) while the body scrolls, inside any consumer `max-height`/`overflow:auto` container — decoupled from `options.scrollable`. Overridable via `--hub-table-head-position`. Defaults to `false`. |
resizableColumns | boolean | false | Lets the user resize columns by dragging the edge of a header cell or with the arrow keys on its handle. A header can opt out with `resizable: false`; the selection column and button-only columns never resize. Initial and runtime widths come from each header (`width`, `minWidth`, `maxWidth`), and a finished resize is written back into `headers`. Default comes from `PaginableDefaults.resizableColumns`. |
flushFields | boolean | false | Draws the form controls inside the cells as a spreadsheet does: no border, no surface of their own. A field is boxed so it can be told apart from the page around it, and a table cell already does that job — so the box gets drawn twice and an editable table reads as a form that fell into a table. Static prepend/append content loses its chip and reads as the plain text or icon it is; a projected button stops being welded to its neighbour, getting its corners back, a gap and its own border colour, because two actions in a cell are two things to press rather than one strip. The control regains its shared corners too. It is a token assignment on the cells rather than an input on each field, which is both why it reaches your own cellTpt content and why it needs ng-hub-ui-forms 22.21.0 for the seam tokens. A field that fails validation is ringed in red and shows its message in a tooltip on hover rather than under the control, so the row keeps its height; that needs ng-hub-ui-forms 22.44.0. |
flush | boolean | — | Draws the collection as a list rather than as a stack of cards: no border, radius or surface per row, a rule between them instead. On `hub-table` it drops the outer border, the radius, the head rule and the cell padding while keeping the row divider, because a table with no line between rows stops being readable across its columns. Right for a list of choices inside a dialog or a panel, where the surface has already drawn the frame. An input rather than something CSS can reach: the token defaults sit on the host, so a consumer class on the same element ties on specificity and loses on source order. Defaults to `false`. |
batchActions | (PaginableTableDropdown | PaginableActionButton)[] | — | Actions shown in the toolbar that operate on the currently selected rows. Each button shows its `label`, or its `title` when it declares none. |
debounce | number | — | Debounce in milliseconds applied to search and filter changes. Defaults to `0`. |
options | PaginableTableOptions | — | Visual/behavioural options: `striped`, `hoverableRows`, `variant`, `cursor`, `scrollable`, `rtl`… |
loading | boolean | — | Renders the loading state. Two-way bindable (`model`) — emits `loadingChange`. |
error | unknown | null | — | When truthy, renders the error state. Two-way bindable (`model`) — emits `errorChange`. |
loadingComponent | PaginableStateDefault | null | — | Per-instance default component for the loading state. |
errorComponent | PaginableStateDefault | null | — | Per-instance default component for the error state. |
noResultsComponent | PaginableStateDefault | null | — | Per-instance default component for the no-results state. |
items (hub-list) | any[] | [] | Hierarchical data of `hub-list`; `null` is read as an empty array. Children are read from the property named by `bindChildren`. |
bindLabel (hub-list) | string | 'label' | Property of each list item shown as its label. |
bindChildren (hub-list) | string | 'children' | Property of each list item that holds its child items, for nested lists. |
sortable (hub-list) | boolean | false | Enables drag-and-drop reordering of the list items (native drag-and-drop with a pointer fallback for touch). |
dragGroup (hub-list) | string | null | null | Shared drag group. Lists with the same non-null group can exchange items; with `null` only in-list reordering is allowed. |
sortDisabled (hub-list) | (item: T) => boolean | () => false | Predicate marking an item as non-draggable. |
canDropInto (hub-list) | (item: T, parentItem: T | null, depth: number) => boolean | () => true | Predicate deciding whether a dragged item may land in a collection, given the item owning it (`null` for the root) and its depth. A refused collection takes no drop. |
keyboardSortable (hub-list) | boolean | false | Enables keyboard reordering on the focused row: Space/Enter to pick up and drop, arrows to move, Escape to cancel. |
connected (hub-list) | boolean | false | Draws a vertical connector between consecutive items (timeline look). Column display only, not cards. |
page (hub-paginator) | number | 1 | Current page of `hub-paginator`. Two-way bindable (`model`) — emits `pageChange`. |
numberOfPages (hub-paginator) | number | null | — | Total number of pages shown by `hub-paginator`. |
rtl (hub-paginator) | boolean | false | Right-to-left behaviour for the paginator controls: icons keep their direction while the actions are mirrored. |
placement (hub-paginator) | 'top' | 'bottom' | null | null | Where the paginator sits when a host draws more than one for the same collection; it is added to the navigation landmark name. |
row (hub-table-dropdown) | TableRowEvent<T> | — | Row data and event the dropdown acts on, handed to each button callback. |
options (hub-table-dropdown) | PaginableTableDropdown | { buttons: [] } | Dropdown configuration: `buttons` plus styling. Missing `position`, `fill` and `color` default to `end`, `clear` and `neutral`. |
appendTo (hub-table-dropdown) | HTMLElement | 'body' | null | 'body' | Element the dropdown menu is appended to. |
disabled (hub-table-dropdown) | boolean | false | Disables the dropdown trigger button. |
type (hub-table-range-input) | 'number' | 'date' | 'number' | Kind of input drawn for the range filter. It is a `ControlValueAccessor`. |
id (hub-dropdown) | string | — | Identifier of the `hub-dropdown` instance. Defaults to a generated unique id. |
config (hub-paginable-icon)Required | string | Icon | undefined | — | Icon to draw, a class string or an `Icon` object. |
hubPaginableActions (directive)Required | ReadonlyArray<DeclaredAction> | — | Row actions declared on a header, rendered through the registered actions adapter (`HUB_PAGINABLE_ACTIONS`). Without an adapter nothing is drawn. |
row (hubPaginableActions) | TableRowEvent<T> | — | Row the declared actions act on. |
hubTableTooltip (directive) | string | null | undefined | '' | Tooltip text for the host control, drawn through the registered tooltip adapter and mirrored to `aria-label` when the control has no visible text. Empty means no tooltip. |
hubPaginableControl (directive)Required | 'input' | 'select' | — | Kind of form control the registered adapter renders in place of the native fallback. |
value (hubPaginableControl) | unknown | '' | Current value, kept in sync with the rendered control. |
controlType (hubPaginableControl) | string | 'text' | Native input type when the kind is `input`. |
placeholder (hubPaginableControl) | string | '' | Placeholder text. |
label (hubPaginableControl) | string | '' | Control name, rendered by the adapter as a real label. |
labelType (hubPaginableControl) | 'floating' | 'stacked' | 'horizontal' | 'visually-hidden' | '' | '' | How the adapter presents `label`. |
ariaLabel (hubPaginableControl) | string | '' | Accessible name applied when the adapter leaves the control anonymous. |
cssClass (hubPaginableControl) | string | '' | Extra CSS class forwarded to the control. |
options (hubPaginableControl) | ReadonlyArray<HubPaginableControlOption> | [] | Options when the kind is `select`. |
template (hub-state-outlet) | TemplateRef<unknown> | null | undefined | null | Content-projected state template, the highest precedence. |
instanceDefault (hub-state-outlet) | PaginableStateDefault | null | null | Per-instance default for the state. |
globalDefault (hub-state-outlet) | ResolvedStateDefault | null | null | Application-wide default resolved by `HubPaginableDefaultsService`. |
fallback (hub-state-outlet)Required | TemplateRef<unknown> | — | Built-in template rendered when nothing else is provided. |
context (hub-state-outlet) | PaginableStateContext | {} | Runtime context handed to the chosen state component. |
Outputs
React to what paginable does — 16 events to hook your logic onto.
| Name | Type | Description |
|---|---|---|
columnResize | PaginableColumnResizeEvent | Emitted once when a resize finishes (pointer release or each keyboard step) with `{ property, width, previousWidth, header }`, widths in px. Not emitted while dragging or when the width did not change. |
pageChange | number | null | Emitted by the two-way `page` model when the current page changes. |
perPageChange | number | null | Emitted by the two-way `perPage` model when the page size changes. |
totalItemsChange | number | null | Emitted by the two-way `totalItems` model (e.g. when a `PaginationState` is bound). |
ordinationChange | PaginableTableOrdination | Emitted by the two-way `ordination` model when sorting changes — use it to drive server-side sorting. |
filtersChange | Record<string, unknown> | null | Emitted by the two-way `filters` model when a column filter changes — use it to drive server-side filtering. |
searchTermChange | string | Emitted by the two-way `searchTerm` model when the global search changes (debounced by `debounce`). |
loadingChange | boolean | Emitted by the two-way `loading` model. |
errorChange | unknown | null | Emitted by the two-way `error` model. |
headersChange | (PaginableTableHeader | string)[] | Emitted by the two-way `headers` model when the column configuration changes. |
sorted (hub-list) | ListSortEvent<T> | Emitted by the destination `hub-list` after a drag-and-drop reorder or cross-list transfer. |
pageChange (hub-paginator) | number | Emitted by the two-way `page` model of `hub-paginator`. |
open (hub-dropdown) | DropdownEvent | Emitted when the `hub-dropdown` opens, with its id. |
close (hub-dropdown) | DropdownEvent | Emitted when the `hub-dropdown` closes, with its id. |
valueChange (hubPaginableControl) | unknown | Emitted whenever the user changes the rendered control value. |
resizable (th[resizable]) | Observable<number> | Emits the width in px while the handle of a resizable header cell is dragged. Used internally by the table; the `resizable` selector is exported but a consumer normally uses `resizableColumns`. |
Templates
Make it yours — 7 template slots let you project custom markup.
| Name | Description | Example |
|---|---|---|
headerTpt | Custom header template for defining custom column headers | <ng-template headerTpt header="name" let-header="header">{{ header.title }}</ng-template> |
cellTpt | Custom cell template for customizing cell content rendering | <ng-template cellTpt header="name" let-item="item">{{ item.name }}</ng-template> |
rowTpt | Custom row template for defining entire row structure | <ng-template rowTpt let-row><tr><td>{{ row.data.name }}</td></tr></ng-template> |
filterTpt | Custom filter template for adding filtering UI elements | <ng-template filterTpt header="name" let-fc="formControl"><input [formControl]="fc"></ng-template> |
loadingTpt | Loading state template for custom loading indicators | <ng-template loadingTpt><div class="spinner"></div></ng-template> |
noResultsTpt | Empty state template displayed when no data is available | <ng-template noResultsTpt><p>No data found</p></ng-template> |
errorTpt | Error state template for handling error conditions | <ng-template errorTpt><p>Something went wrong</p></ng-template> |