createDataTable API
API reference for the createDataTable composable.
(options: DataTableOptions<T>) => DataTableContext<T>Creates a data table instance with sort controls, selection, and an
adapter-driven data pipeline.
Must be called inside a component `setup()` or a Vue effect scope.
Calling at module scope in SSR environments causes request state leakage.
(_options: DataTableContextOptions<T>) => ContextTrinity<DataTableContext<T>>Creates a data table context with dependency injection support.
(namespace?: string) => DataTableContext<T>Returns the current data table context from dependency injection.
MaybeRefOrGetter<T[]>Source items
readonly DataTableColumn<T>[]Column definitions
KeysOfType<T, ID>Property used as row identifier. Must resolve to a string or number value.
Default: 'id'
Omit<FilterOptions, "keys">Filter options (keys derived from columns)
Omit<PaginationOptions, "size">Pagination options (size derived from pipeline)
booleanEnable multi-column sort.
Default: false
booleanPrevent clearing sort (asc → desc → asc cycle).
Default: false
"asc" | "desc"Direction for first sort click.
Default: 'asc'
SelectStrategySelection strategy: 'single' selects one row, 'page' operates on visible items, 'all' operates on all filtered items.
Default: 'page'
keyof T & stringProperty that controls per-row selectability
keyof T & stringColumn key to group rows by
booleanAuto-open all groups on creation.
Default: false
booleanAllow multiple rows expanded simultaneously.
Default: true
stringLocale for sorting (defaults to useLocale's selected locale or browser default)
DataTableAdapterInterface<T>Pipeline adapter.
Default: ClientAdapter
Readonly<Ref<readonly T[], readonly T[]>>Final paginated items for rendering
Readonly<Ref<readonly T[], readonly T[]>>Raw unprocessed items
Readonly<Ref<readonly T[], readonly T[]>>Items after filtering
Readonly<Ref<readonly T[], readonly T[]>>Items after filtering and sorting
readonly DataTableColumn<T>[]Column definitions
Readonly<ShallowRef<string>>Current search query (readonly)
DataTableSortSort controls
PaginationContextPagination controls
DataTableSelectionRow selection controls
DataTableExpansionRow expansion controls
DataTableGrouping<T>Row grouping controls. When groupBy is not set, `groups` returns an empty array.
Readonly<Ref<number, number>>Total row count for aria-rowcount
Readonly<Ref<boolean, boolean>>Loading state (managed by adapter)
Readonly<Ref<Error, Error>>Error state (managed by adapter)
(value: string) => voidSet the search query