useExpanded

DataTable
stable

Injects the expand context provided by provideExpanded() inside OrigamDataTable. Gives child components access to the expanded rows Set, expand/collapse handlers, and the expandOnClick flag — without prop-drilling.

API

Signature

Full TypeScript signature sourced from the composable file.

typescript

useExpanded() throws if called outside a component tree where provideExpanded() has run. It is safe to call inside any custom cell/row slot of OrigamDataTable.

Consumed interfaces

IDataTableExpandProps
IDataTableProvideExpanded
IDataTableItem

API

Return values

Properties and methods exposed by the composable return object.

expanded
Reactive Set of expanded row keys. Bound to the parent v-model:expanded.
expandOnClick
When true, clicking a row expands it without needing an explicit expand button.
expand
Explicitly expand or collapse a row by its item reference and a boolean flag.
isExpanded
Returns true if the given item's value key is present in the expanded Set.
toggleExpand
Toggles the expanded state of a row — expands it if collapsed, collapses it if expanded.

Usage

Examples

Ready-to-paste usage snippets.

Custom expand cell using useExpanded

vue

DataTable with expandable rows

vue