Table Docs
API Reference
Table API Reference
- Table
- TableOptions
- TableState
- TableMeta
- TableFeature
- TableFeatures
- StockFeatures
- CoreFeatures
- BaseAtoms
- Atoms
- ExternalAtoms
- constructTable
- tableOptions
- tableFeatures
- getInitialTableState
- OnChangeFn
- Updater
- DebugOptions
- TableController
- createTableHook
- LitTable
- AppLitTable
- CreateTableHookOptions
- subscribe
- SubscribeDirective
- SelectionSource
- FlexRender
- flexRender
Column API Reference
Row API Reference
Cell API Reference
Header API Reference
Features API Reference
- stockFeatures
- coreFeatures
- coreCellsFeature
- coreColumnsFeature
- coreHeadersFeature
- coreRowModelsFeature
- coreRowsFeature
- coreTablesFeature
- cellSpanningFeature
- columnFilteringFeature
- columnFacetingFeature
- rowAggregationFeature
- columnGroupingFeature
- columnOrderingFeature
- columnPinningFeature
- columnResizingFeature
- columnSizingFeature
- columnVisibilityFeature
- globalFilteringFeature
- rowExpandingFeature
- rowPaginationFeature
- rowPinningFeature
- rowSelectionFeature
- rowSortingFeature
- filterFns
- sortFns
- aggregationFns
- ColumnFilter
- ColumnPinningState
- ColumnSort
- PaginationState
- RowPinningState
- columnResizingState
- FilterFn
- FilterFns
- FilterMeta
- SortFn
- SortFns
- AggregationFns
- AggregationContext
- AggregationMergeContext
- AggregationFnDef
- AggregationFnDescriptor
- AggregationValueContext
- AggregationValueResult
- constructAggregationFn
- ColumnFiltersState
- ColumnOrderState
- ColumnPinningPosition
- ColumnResizeDirection
- ColumnResizeMode
- ColumnSizingState
- ColumnVisibilityState
- ExpandedState
- GroupingState
- RowPinningPosition
- RowSelectionState
- SortDirection
- SortingState
- AggregationFnOption
- AggregationResult
- FilterFnOption
- SortFnOption
- BuiltInAggregationFn
- BuiltInFilterFn
- BuiltInSortFn
Static Functions API Reference
AI/LLM: This documentation page is available in plain markdown format at/table/latest/docs/framework/lit/reference/variables/subscribe.md
Table API Reference
subscribe
ts
const subscribe: {
<TSource> (source, template): DirectiveResult<typeof SubscribeDirective>;
<TSource, TSelected> (source, selector, template): DirectiveResult<typeof SubscribeDirective>;
};Defined in: packages/lit-table/src/subscribe-directive.ts:191
A Lit directive that subscribes to a source (Store or Atom) and efficiently updates only the wrapped template when the state or selected slice changes.
Call Signature#
ts
<TSource>(source, template): DirectiveResult<typeof SubscribeDirective>;Subscribes to the entire source state without filtering.
Type Parameters#
TSource#
TSource
Parameters#
source#
SelectionSource<TSource>
template#
TemplateFunction<TSource>
Returns#
DirectiveResult<typeof SubscribeDirective>
Call Signature#
ts
<TSource, TSelected>(
source,
selector,
template): DirectiveResult<typeof SubscribeDirective>;Subscribes to a specific slice of the source state via a selector, preventing unnecessary re-renders when other parts of the state change.
Type Parameters#
TSource#
TSource
TSelected#
TSelected
Parameters#
source#
SelectionSource<TSource>
selector#
Selector<TSource, TSelected>
template#
TemplateFunction<TSelected>
Returns#
DirectiveResult<typeof SubscribeDirective>
Example#
ts
// Without a selector (subscribes to entire state)
html`<div>${subscribe(myStore, (state) => html`<span>${state.count}</span>`)}</div>`
* // With a selector (only updates when `count` changes)
html`<div>${subscribe(myStore, state => state.count, (count) => html`<span>${count}</span>`)}</div>`