@nocopypaste/vue-grid 0.0.0-stage → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (473) hide show
  1. package/AGENTS.md +350 -0
  2. package/CHANGELOG.md +70 -0
  3. package/README.md +1046 -2
  4. package/agent/api.json +2453 -0
  5. package/agent/api.md +648 -0
  6. package/agent/grid-config.schema.json +654 -0
  7. package/dist/agent/api.js +2409 -0
  8. package/dist/agent/api.js.map +1 -0
  9. package/dist/agent/index.js +8 -0
  10. package/dist/agent/index.js.map +1 -0
  11. package/dist/agent/requirements.js +66 -0
  12. package/dist/agent/requirements.js.map +1 -0
  13. package/dist/agent/validate.js +185 -0
  14. package/dist/agent/validate.js.map +1 -0
  15. package/dist/base.css +1 -0
  16. package/dist/components/VGrid.js +6 -0
  17. package/dist/components/VGrid.js.map +1 -0
  18. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js +843 -0
  19. package/dist/components/VGrid.vue_vue_type_script_setup_true_lang.js.map +1 -0
  20. package/dist/components/VGridCell.js +6 -0
  21. package/dist/components/VGridCell.js.map +1 -0
  22. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js +167 -0
  23. package/dist/components/VGridCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  24. package/dist/components/VGridCheckbox.js +6 -0
  25. package/dist/components/VGridCheckbox.js.map +1 -0
  26. package/dist/components/VGridCheckbox.vue_vue_type_script_setup_true_lang.js +44 -0
  27. package/dist/components/VGridCheckbox.vue_vue_type_script_setup_true_lang.js.map +1 -0
  28. package/dist/components/VGridColumnMenu.js +6 -0
  29. package/dist/components/VGridColumnMenu.js.map +1 -0
  30. package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js +100 -0
  31. package/dist/components/VGridColumnMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
  32. package/dist/components/VGridFilterInput.js +6 -0
  33. package/dist/components/VGridFilterInput.js.map +1 -0
  34. package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js +89 -0
  35. package/dist/components/VGridFilterInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
  36. package/dist/components/VGridFilterPanel.js +6 -0
  37. package/dist/components/VGridFilterPanel.js.map +1 -0
  38. package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js +248 -0
  39. package/dist/components/VGridFilterPanel.vue_vue_type_script_setup_true_lang.js.map +1 -0
  40. package/dist/components/VGridFilterPopover.js +6 -0
  41. package/dist/components/VGridFilterPopover.js.map +1 -0
  42. package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js +79 -0
  43. package/dist/components/VGridFilterPopover.vue_vue_type_script_setup_true_lang.js.map +1 -0
  44. package/dist/components/VGridGroupCells.js +6 -0
  45. package/dist/components/VGridGroupCells.js.map +1 -0
  46. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js +181 -0
  47. package/dist/components/VGridGroupCells.vue_vue_type_script_setup_true_lang.js.map +1 -0
  48. package/dist/components/VGridGroupRow.js +6 -0
  49. package/dist/components/VGridGroupRow.js.map +1 -0
  50. package/dist/components/VGridGroupRow.vue_vue_type_script_setup_true_lang.js +49 -0
  51. package/dist/components/VGridGroupRow.vue_vue_type_script_setup_true_lang.js.map +1 -0
  52. package/dist/components/VGridHeader.js +6 -0
  53. package/dist/components/VGridHeader.js.map +1 -0
  54. package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js +130 -0
  55. package/dist/components/VGridHeader.vue_vue_type_script_setup_true_lang.js.map +1 -0
  56. package/dist/components/VGridMenu.js +6 -0
  57. package/dist/components/VGridMenu.js.map +1 -0
  58. package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js +133 -0
  59. package/dist/components/VGridMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
  60. package/dist/components/VGridPagination.js +6 -0
  61. package/dist/components/VGridPagination.js.map +1 -0
  62. package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js +102 -0
  63. package/dist/components/VGridPagination.vue_vue_type_script_setup_true_lang.js.map +1 -0
  64. package/dist/components/VGridPinnedRows.js +6 -0
  65. package/dist/components/VGridPinnedRows.js.map +1 -0
  66. package/dist/components/VGridPinnedRows.vue_vue_type_script_setup_true_lang.js +75 -0
  67. package/dist/components/VGridPinnedRows.vue_vue_type_script_setup_true_lang.js.map +1 -0
  68. package/dist/components/VGridResizeHandle.js +6 -0
  69. package/dist/components/VGridResizeHandle.js.map +1 -0
  70. package/dist/components/VGridResizeHandle.vue_vue_type_script_setup_true_lang.js +34 -0
  71. package/dist/components/VGridResizeHandle.vue_vue_type_script_setup_true_lang.js.map +1 -0
  72. package/dist/components/VGridRows.js +6 -0
  73. package/dist/components/VGridRows.js.map +1 -0
  74. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js +191 -0
  75. package/dist/components/VGridRows.vue_vue_type_script_setup_true_lang.js.map +1 -0
  76. package/dist/components/VGridSearch.js +6 -0
  77. package/dist/components/VGridSearch.js.map +1 -0
  78. package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js +46 -0
  79. package/dist/components/VGridSearch.vue_vue_type_script_setup_true_lang.js.map +1 -0
  80. package/dist/components/VGridSelectionBanner.js +6 -0
  81. package/dist/components/VGridSelectionBanner.js.map +1 -0
  82. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js +33 -0
  83. package/dist/components/VGridSelectionBanner.vue_vue_type_script_setup_true_lang.js.map +1 -0
  84. package/dist/components/VGridTotalCell.js +6 -0
  85. package/dist/components/VGridTotalCell.js.map +1 -0
  86. package/dist/components/VGridTotalCell.vue_vue_type_script_setup_true_lang.js +74 -0
  87. package/dist/components/VGridTotalCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  88. package/dist/composables/useColumnDrag.js +79 -0
  89. package/dist/composables/useColumnDrag.js.map +1 -0
  90. package/dist/composables/useColumnResize.js +68 -0
  91. package/dist/composables/useColumnResize.js.map +1 -0
  92. package/dist/composables/useDataSource.js +47 -0
  93. package/dist/composables/useDataSource.js.map +1 -0
  94. package/dist/composables/useGridExport.js +135 -0
  95. package/dist/composables/useGridExport.js.map +1 -0
  96. package/dist/composables/useGridFilters.js +125 -0
  97. package/dist/composables/useGridFilters.js.map +1 -0
  98. package/dist/composables/useGridKeyboard.js +115 -0
  99. package/dist/composables/useGridKeyboard.js.map +1 -0
  100. package/dist/composables/useGridMenus.js +234 -0
  101. package/dist/composables/useGridMenus.js.map +1 -0
  102. package/dist/composables/useGridSelection.js +138 -0
  103. package/dist/composables/useGridSelection.js.map +1 -0
  104. package/dist/composables/usePinnedOffsets.js +61 -0
  105. package/dist/composables/usePinnedOffsets.js.map +1 -0
  106. package/dist/composables/usePinnedRows.js +58 -0
  107. package/dist/composables/usePinnedRows.js.map +1 -0
  108. package/dist/composables/useRowGrouping.js +103 -0
  109. package/dist/composables/useRowGrouping.js.map +1 -0
  110. package/dist/composables/useScrollEdges.js +27 -0
  111. package/dist/composables/useScrollEdges.js.map +1 -0
  112. package/dist/composables/useSubRows.js +101 -0
  113. package/dist/composables/useSubRows.js.map +1 -0
  114. package/dist/composables/useTotals.js +30 -0
  115. package/dist/composables/useTotals.js.map +1 -0
  116. package/dist/composables/useVirtualRows.js +160 -0
  117. package/dist/composables/useVirtualRows.js.map +1 -0
  118. package/dist/core/aggregate.js +39 -0
  119. package/dist/core/aggregate.js.map +1 -0
  120. package/dist/core/columns.js +106 -0
  121. package/dist/core/columns.js.map +1 -0
  122. package/dist/core/csv.js +28 -0
  123. package/dist/core/csv.js.map +1 -0
  124. package/dist/core/filter.js +218 -0
  125. package/dist/core/filter.js.map +1 -0
  126. package/dist/core/grouping.js +66 -0
  127. package/dist/core/grouping.js.map +1 -0
  128. package/dist/core/helpers.js +7 -0
  129. package/dist/core/helpers.js.map +1 -0
  130. package/dist/core/pagination.js +25 -0
  131. package/dist/core/pagination.js.map +1 -0
  132. package/dist/core/patch.js +41 -0
  133. package/dist/core/patch.js.map +1 -0
  134. package/dist/core/selection.js +15 -0
  135. package/dist/core/selection.js.map +1 -0
  136. package/dist/core/sort.js +36 -0
  137. package/dist/core/sort.js.map +1 -0
  138. package/dist/core/storage.js +36 -0
  139. package/dist/core/storage.js.map +1 -0
  140. package/dist/core/value.js +19 -0
  141. package/dist/core/value.js.map +1 -0
  142. package/dist/core/virtual.js +83 -0
  143. package/dist/core/virtual.js.map +1 -0
  144. package/dist/core.css +1 -0
  145. package/dist/features/aggregation.js +11 -0
  146. package/dist/features/aggregation.js.map +1 -0
  147. package/dist/features/columnGroups.js +9 -0
  148. package/dist/features/columnGroups.js.map +1 -0
  149. package/dist/features/columnPinning.js +11 -0
  150. package/dist/features/columnPinning.js.map +1 -0
  151. package/dist/features/columnReorder.js +12 -0
  152. package/dist/features/columnReorder.js.map +1 -0
  153. package/dist/features/columnResizing.js +11 -0
  154. package/dist/features/columnResizing.js.map +1 -0
  155. package/dist/features/columnVisibility.js +9 -0
  156. package/dist/features/columnVisibility.js.map +1 -0
  157. package/dist/features/export.js +9 -0
  158. package/dist/features/export.js.map +1 -0
  159. package/dist/features/filtering.js +13 -0
  160. package/dist/features/filtering.js.map +1 -0
  161. package/dist/features/index.js +42 -0
  162. package/dist/features/index.js.map +1 -0
  163. package/dist/features/keyboardNavigation.js +9 -0
  164. package/dist/features/keyboardNavigation.js.map +1 -0
  165. package/dist/features/menus.js +11 -0
  166. package/dist/features/menus.js.map +1 -0
  167. package/dist/features/pagination.js +9 -0
  168. package/dist/features/pagination.js.map +1 -0
  169. package/dist/features/rowGrouping.js +11 -0
  170. package/dist/features/rowGrouping.js.map +1 -0
  171. package/dist/features/rowPinning.js +11 -0
  172. package/dist/features/rowPinning.js.map +1 -0
  173. package/dist/features/selection.js +13 -0
  174. package/dist/features/selection.js.map +1 -0
  175. package/dist/features/serverData.js +9 -0
  176. package/dist/features/serverData.js.map +1 -0
  177. package/dist/features/sorting.js +9 -0
  178. package/dist/features/sorting.js.map +1 -0
  179. package/dist/features/subGrids.js +9 -0
  180. package/dist/features/subGrids.js.map +1 -0
  181. package/dist/features/virtualScrolling.js +9 -0
  182. package/dist/features/virtualScrolling.js.map +1 -0
  183. package/dist/index.js +71 -0
  184. package/dist/internal/RenderSlot.js +6 -0
  185. package/dist/internal/RenderSlot.js.map +1 -0
  186. package/dist/internal/anchor.js +41 -0
  187. package/dist/internal/anchor.js.map +1 -0
  188. package/dist/internal/clipboard.js +17 -0
  189. package/dist/internal/clipboard.js.map +1 -0
  190. package/dist/internal/context.js +11 -0
  191. package/dist/internal/context.js.map +1 -0
  192. package/dist/internal/dev.js +8 -0
  193. package/dist/internal/dev.js.map +1 -0
  194. package/dist/internal/features.js +9 -0
  195. package/dist/internal/features.js.map +1 -0
  196. package/dist/internal/supports.js +10 -0
  197. package/dist/internal/supports.js.map +1 -0
  198. package/dist/internal/touchHold.js +43 -0
  199. package/dist/internal/touchHold.js.map +1 -0
  200. package/dist/registry/plugin.js +25 -0
  201. package/dist/registry/plugin.js.map +1 -0
  202. package/dist/registry/registry.js +15 -0
  203. package/dist/registry/registry.js.map +1 -0
  204. package/dist/renderers/ActionButtonCell.js +6 -0
  205. package/dist/renderers/ActionButtonCell.js.map +1 -0
  206. package/dist/renderers/ActionButtonCell.vue_vue_type_script_setup_true_lang.js +44 -0
  207. package/dist/renderers/ActionButtonCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  208. package/dist/renderers/ActionsMenuCell.js +6 -0
  209. package/dist/renderers/ActionsMenuCell.js.map +1 -0
  210. package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js +75 -0
  211. package/dist/renderers/ActionsMenuCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  212. package/dist/renderers/BooleanCell.js +6 -0
  213. package/dist/renderers/BooleanCell.js.map +1 -0
  214. package/dist/renderers/BooleanCell.vue_vue_type_script_setup_true_lang.js +45 -0
  215. package/dist/renderers/BooleanCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  216. package/dist/renderers/ButtonGroupCell.js +6 -0
  217. package/dist/renderers/ButtonGroupCell.js.map +1 -0
  218. package/dist/renderers/ButtonGroupCell.vue_vue_type_script_setup_true_lang.js +46 -0
  219. package/dist/renderers/ButtonGroupCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  220. package/dist/renderers/ChangeCell.js +6 -0
  221. package/dist/renderers/ChangeCell.js.map +1 -0
  222. package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js +59 -0
  223. package/dist/renderers/ChangeCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  224. package/dist/renderers/CheckboxCell.js +6 -0
  225. package/dist/renderers/CheckboxCell.js.map +1 -0
  226. package/dist/renderers/CheckboxCell.vue_vue_type_script_setup_true_lang.js +41 -0
  227. package/dist/renderers/CheckboxCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  228. package/dist/renderers/ChipCell.js +6 -0
  229. package/dist/renderers/ChipCell.js.map +1 -0
  230. package/dist/renderers/ChipCell.vue_vue_type_script_setup_true_lang.js +59 -0
  231. package/dist/renderers/ChipCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  232. package/dist/renderers/CodeCell.js +6 -0
  233. package/dist/renderers/CodeCell.js.map +1 -0
  234. package/dist/renderers/CodeCell.vue_vue_type_script_setup_true_lang.js +49 -0
  235. package/dist/renderers/CodeCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  236. package/dist/renderers/CopyCell.js +6 -0
  237. package/dist/renderers/CopyCell.js.map +1 -0
  238. package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js +51 -0
  239. package/dist/renderers/CopyCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  240. package/dist/renderers/CurrencyCell.js +6 -0
  241. package/dist/renderers/CurrencyCell.js.map +1 -0
  242. package/dist/renderers/CurrencyCell.vue_vue_type_script_setup_true_lang.js +38 -0
  243. package/dist/renderers/CurrencyCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  244. package/dist/renderers/DateCell.js +6 -0
  245. package/dist/renderers/DateCell.js.map +1 -0
  246. package/dist/renderers/DateCell.vue_vue_type_script_setup_true_lang.js +30 -0
  247. package/dist/renderers/DateCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  248. package/dist/renderers/DateTimeCell.js +6 -0
  249. package/dist/renderers/DateTimeCell.js.map +1 -0
  250. package/dist/renderers/DateTimeCell.vue_vue_type_script_setup_true_lang.js +34 -0
  251. package/dist/renderers/DateTimeCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  252. package/dist/renderers/DetailsCell.js +6 -0
  253. package/dist/renderers/DetailsCell.js.map +1 -0
  254. package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js +82 -0
  255. package/dist/renderers/DetailsCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  256. package/dist/renderers/EditCell.js +6 -0
  257. package/dist/renderers/EditCell.js.map +1 -0
  258. package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js +41 -0
  259. package/dist/renderers/EditCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  260. package/dist/renderers/IconCell.js +6 -0
  261. package/dist/renderers/IconCell.js.map +1 -0
  262. package/dist/renderers/IconCell.vue_vue_type_script_setup_true_lang.js +39 -0
  263. package/dist/renderers/IconCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  264. package/dist/renderers/IconToggleCell.js +6 -0
  265. package/dist/renderers/IconToggleCell.js.map +1 -0
  266. package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js +44 -0
  267. package/dist/renderers/IconToggleCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  268. package/dist/renderers/ImageCell.js +6 -0
  269. package/dist/renderers/ImageCell.js.map +1 -0
  270. package/dist/renderers/ImageCell.vue_vue_type_script_setup_true_lang.js +47 -0
  271. package/dist/renderers/ImageCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  272. package/dist/renderers/JsonCell.js +6 -0
  273. package/dist/renderers/JsonCell.js.map +1 -0
  274. package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js +47 -0
  275. package/dist/renderers/JsonCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  276. package/dist/renderers/JsonTreeCell.js +6 -0
  277. package/dist/renderers/JsonTreeCell.js.map +1 -0
  278. package/dist/renderers/JsonTreeCell.vue_vue_type_script_setup_true_lang.js +56 -0
  279. package/dist/renderers/JsonTreeCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  280. package/dist/renderers/JsonTreeNode.js +6 -0
  281. package/dist/renderers/JsonTreeNode.js.map +1 -0
  282. package/dist/renderers/JsonTreeNode.vue_vue_type_script_setup_true_lang.js +80 -0
  283. package/dist/renderers/JsonTreeNode.vue_vue_type_script_setup_true_lang.js.map +1 -0
  284. package/dist/renderers/LinkCell.js +6 -0
  285. package/dist/renderers/LinkCell.js.map +1 -0
  286. package/dist/renderers/LinkCell.vue_vue_type_script_setup_true_lang.js +63 -0
  287. package/dist/renderers/LinkCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  288. package/dist/renderers/ListCell.js +6 -0
  289. package/dist/renderers/ListCell.js.map +1 -0
  290. package/dist/renderers/ListCell.vue_vue_type_script_setup_true_lang.js +46 -0
  291. package/dist/renderers/ListCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  292. package/dist/renderers/MultiLineCell.js +6 -0
  293. package/dist/renderers/MultiLineCell.js.map +1 -0
  294. package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js +102 -0
  295. package/dist/renderers/MultiLineCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  296. package/dist/renderers/NumberCell.js +6 -0
  297. package/dist/renderers/NumberCell.js.map +1 -0
  298. package/dist/renderers/NumberCell.vue_vue_type_script_setup_true_lang.js +35 -0
  299. package/dist/renderers/NumberCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  300. package/dist/renderers/RadioCell.js +6 -0
  301. package/dist/renderers/RadioCell.js.map +1 -0
  302. package/dist/renderers/RadioCell.vue_vue_type_script_setup_true_lang.js +43 -0
  303. package/dist/renderers/RadioCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  304. package/dist/renderers/StatusCell.js +6 -0
  305. package/dist/renderers/StatusCell.js.map +1 -0
  306. package/dist/renderers/StatusCell.vue_vue_type_script_setup_true_lang.js +51 -0
  307. package/dist/renderers/StatusCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  308. package/dist/renderers/SwitchCell.js +6 -0
  309. package/dist/renderers/SwitchCell.js.map +1 -0
  310. package/dist/renderers/SwitchCell.vue_vue_type_script_setup_true_lang.js +41 -0
  311. package/dist/renderers/SwitchCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  312. package/dist/renderers/TextCell.js +6 -0
  313. package/dist/renderers/TextCell.js.map +1 -0
  314. package/dist/renderers/TextCell.vue_vue_type_script_setup_true_lang.js +92 -0
  315. package/dist/renderers/TextCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  316. package/dist/renderers/ToggleTextCell.js +6 -0
  317. package/dist/renderers/ToggleTextCell.js.map +1 -0
  318. package/dist/renderers/ToggleTextCell.vue_vue_type_script_setup_true_lang.js +36 -0
  319. package/dist/renderers/ToggleTextCell.vue_vue_type_script_setup_true_lang.js.map +1 -0
  320. package/dist/renderers/format.js +142 -0
  321. package/dist/renderers/format.js.map +1 -0
  322. package/dist/renderers/index.js +199 -0
  323. package/dist/renderers/index.js.map +1 -0
  324. package/dist/renderers/options.js +17 -0
  325. package/dist/renderers/options.js.map +1 -0
  326. package/dist/renderers/parts/CopyButton.js +6 -0
  327. package/dist/renderers/parts/CopyButton.js.map +1 -0
  328. package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js +37 -0
  329. package/dist/renderers/parts/CopyButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
  330. package/dist/renderers/parts/NumberValue.js +6 -0
  331. package/dist/renderers/parts/NumberValue.js.map +1 -0
  332. package/dist/renderers/parts/NumberValue.vue_vue_type_script_setup_true_lang.js +25 -0
  333. package/dist/renderers/parts/NumberValue.vue_vue_type_script_setup_true_lang.js.map +1 -0
  334. package/dist/renderers/parts/ValueBadge.js +6 -0
  335. package/dist/renderers/parts/ValueBadge.js.map +1 -0
  336. package/dist/renderers/parts/ValueBadge.vue_vue_type_script_setup_true_lang.js +17 -0
  337. package/dist/renderers/parts/ValueBadge.vue_vue_type_script_setup_true_lang.js.map +1 -0
  338. package/dist/renderers/parts/icons.js +27 -0
  339. package/dist/renderers/parts/icons.js.map +1 -0
  340. package/dist/renderers/parts/routerLink.js +9 -0
  341. package/dist/renderers/parts/routerLink.js.map +1 -0
  342. package/dist/renderers/parts/useToggleControl.js +15 -0
  343. package/dist/renderers/parts/useToggleControl.js.map +1 -0
  344. package/dist/renderers/plainText.js +34 -0
  345. package/dist/renderers/plainText.js.map +1 -0
  346. package/dist/renderers/text.js +10 -0
  347. package/dist/renderers/text.js.map +1 -0
  348. package/dist/renderers.css +1 -0
  349. package/dist/theme.css +1 -0
  350. package/dist/types/agent/index.d.ts +50 -0
  351. package/dist/types/agent/requirements.d.ts +17 -0
  352. package/dist/types/agent/validate.d.ts +33 -0
  353. package/dist/types/components/VGrid.vue.d.ts +243 -0
  354. package/dist/types/components/VGridCell.vue.d.ts +19 -0
  355. package/dist/types/components/VGridCheckbox.vue.d.ts +14 -0
  356. package/dist/types/components/VGridColumnMenu.vue.d.ts +22 -0
  357. package/dist/types/components/VGridFilterInput.vue.d.ts +17 -0
  358. package/dist/types/components/VGridFilterPanel.vue.d.ts +20 -0
  359. package/dist/types/components/VGridFilterPopover.vue.d.ts +12 -0
  360. package/dist/types/components/VGridGroupCells.vue.d.ts +14 -0
  361. package/dist/types/components/VGridGroupRow.vue.d.ts +3 -0
  362. package/dist/types/components/VGridHeader.vue.d.ts +26 -0
  363. package/dist/types/components/VGridMenu.vue.d.ts +42 -0
  364. package/dist/types/components/VGridPagination.vue.d.ts +27 -0
  365. package/dist/types/components/VGridPinnedRows.vue.d.ts +15 -0
  366. package/dist/types/components/VGridResizeHandle.vue.d.ts +8 -0
  367. package/dist/types/components/VGridRows.vue.d.ts +28 -0
  368. package/dist/types/components/VGridSearch.vue.d.ts +22 -0
  369. package/dist/types/components/VGridSelectionBanner.vue.d.ts +18 -0
  370. package/dist/types/components/VGridTotalCell.vue.d.ts +13 -0
  371. package/dist/types/composables/useColumnDrag.d.ts +26 -0
  372. package/dist/types/composables/useColumnResize.d.ts +29 -0
  373. package/dist/types/composables/useDataSource.d.ts +39 -0
  374. package/dist/types/composables/useGridExport.d.ts +49 -0
  375. package/dist/types/composables/useGridFilters.d.ts +45 -0
  376. package/dist/types/composables/useGridKeyboard.d.ts +16 -0
  377. package/dist/types/composables/useGridMenus.d.ts +63 -0
  378. package/dist/types/composables/useGridSelection.d.ts +51 -0
  379. package/dist/types/composables/usePinnedOffsets.d.ts +22 -0
  380. package/dist/types/composables/usePinnedRows.d.ts +26 -0
  381. package/dist/types/composables/useRowGrouping.d.ts +50 -0
  382. package/dist/types/composables/useScrollEdges.d.ts +8 -0
  383. package/dist/types/composables/useSubRows.d.ts +38 -0
  384. package/dist/types/composables/useTotals.d.ts +17 -0
  385. package/dist/types/composables/useVirtualRows.d.ts +74 -0
  386. package/dist/types/core/aggregate.d.ts +9 -0
  387. package/dist/types/core/columns.d.ts +35 -0
  388. package/dist/types/core/csv.d.ts +25 -0
  389. package/dist/types/core/filter.d.ts +85 -0
  390. package/dist/types/core/grouping.d.ts +51 -0
  391. package/dist/types/core/helpers.d.ts +3 -0
  392. package/dist/types/core/pagination.d.ts +3 -0
  393. package/dist/types/core/patch.d.ts +23 -0
  394. package/dist/types/core/selection.d.ts +8 -0
  395. package/dist/types/core/sort.d.ts +10 -0
  396. package/dist/types/core/storage.d.ts +6 -0
  397. package/dist/types/core/value.d.ts +6 -0
  398. package/dist/types/core/virtual.d.ts +72 -0
  399. package/dist/types/features/aggregation.d.ts +8 -0
  400. package/dist/types/features/columnGroups.d.ts +7 -0
  401. package/dist/types/features/columnPinning.d.ts +7 -0
  402. package/dist/types/features/columnReorder.d.ts +7 -0
  403. package/dist/types/features/columnResizing.d.ts +8 -0
  404. package/dist/types/features/columnVisibility.d.ts +7 -0
  405. package/dist/types/features/export.d.ts +8 -0
  406. package/dist/types/features/filtering.d.ts +7 -0
  407. package/dist/types/features/index.d.ts +22 -0
  408. package/dist/types/features/keyboardNavigation.d.ts +10 -0
  409. package/dist/types/features/menus.d.ts +8 -0
  410. package/dist/types/features/pagination.d.ts +8 -0
  411. package/dist/types/features/rowGrouping.d.ts +8 -0
  412. package/dist/types/features/rowPinning.d.ts +8 -0
  413. package/dist/types/features/selection.d.ts +8 -0
  414. package/dist/types/features/serverData.d.ts +6 -0
  415. package/dist/types/features/sorting.d.ts +6 -0
  416. package/dist/types/features/subGrids.d.ts +6 -0
  417. package/dist/types/features/virtualScrolling.d.ts +8 -0
  418. package/dist/types/index.d.ts +23 -0
  419. package/dist/types/internal/RenderSlot.d.ts +6 -0
  420. package/dist/types/internal/anchor.d.ts +18 -0
  421. package/dist/types/internal/clipboard.d.ts +6 -0
  422. package/dist/types/internal/context.d.ts +130 -0
  423. package/dist/types/internal/dev.d.ts +1 -0
  424. package/dist/types/internal/features.d.ts +24 -0
  425. package/dist/types/internal/supports.d.ts +11 -0
  426. package/dist/types/internal/touchHold.d.ts +19 -0
  427. package/dist/types/registry/plugin.d.ts +18 -0
  428. package/dist/types/registry/registry.d.ts +18 -0
  429. package/dist/types/renderers/ActionButtonCell.vue.d.ts +10 -0
  430. package/dist/types/renderers/ActionsMenuCell.vue.d.ts +10 -0
  431. package/dist/types/renderers/BooleanCell.vue.d.ts +6 -0
  432. package/dist/types/renderers/ButtonGroupCell.vue.d.ts +10 -0
  433. package/dist/types/renderers/ChangeCell.vue.d.ts +6 -0
  434. package/dist/types/renderers/CheckboxCell.vue.d.ts +10 -0
  435. package/dist/types/renderers/ChipCell.vue.d.ts +6 -0
  436. package/dist/types/renderers/CodeCell.vue.d.ts +6 -0
  437. package/dist/types/renderers/CopyCell.vue.d.ts +10 -0
  438. package/dist/types/renderers/CurrencyCell.vue.d.ts +10 -0
  439. package/dist/types/renderers/DateCell.vue.d.ts +6 -0
  440. package/dist/types/renderers/DateTimeCell.vue.d.ts +6 -0
  441. package/dist/types/renderers/DetailsCell.vue.d.ts +6 -0
  442. package/dist/types/renderers/EditCell.vue.d.ts +10 -0
  443. package/dist/types/renderers/IconCell.vue.d.ts +6 -0
  444. package/dist/types/renderers/IconToggleCell.vue.d.ts +10 -0
  445. package/dist/types/renderers/ImageCell.vue.d.ts +6 -0
  446. package/dist/types/renderers/JsonCell.vue.d.ts +6 -0
  447. package/dist/types/renderers/JsonTreeCell.vue.d.ts +6 -0
  448. package/dist/types/renderers/JsonTreeNode.vue.d.ts +14 -0
  449. package/dist/types/renderers/LinkCell.vue.d.ts +10 -0
  450. package/dist/types/renderers/ListCell.vue.d.ts +10 -0
  451. package/dist/types/renderers/MultiLineCell.vue.d.ts +10 -0
  452. package/dist/types/renderers/NumberCell.vue.d.ts +12 -0
  453. package/dist/types/renderers/RadioCell.vue.d.ts +10 -0
  454. package/dist/types/renderers/StatusCell.vue.d.ts +10 -0
  455. package/dist/types/renderers/SwitchCell.vue.d.ts +10 -0
  456. package/dist/types/renderers/TextCell.vue.d.ts +10 -0
  457. package/dist/types/renderers/ToggleTextCell.vue.d.ts +10 -0
  458. package/dist/types/renderers/format.d.ts +27 -0
  459. package/dist/types/renderers/index.d.ts +132 -0
  460. package/dist/types/renderers/options.d.ts +325 -0
  461. package/dist/types/renderers/parts/CopyButton.vue.d.ts +16 -0
  462. package/dist/types/renderers/parts/NumberValue.vue.d.ts +12 -0
  463. package/dist/types/renderers/parts/ValueBadge.vue.d.ts +7 -0
  464. package/dist/types/renderers/parts/icons.d.ts +21 -0
  465. package/dist/types/renderers/parts/routerLink.d.ts +7 -0
  466. package/dist/types/renderers/parts/useToggleControl.d.ts +12 -0
  467. package/dist/types/renderers/plainText.d.ts +17 -0
  468. package/dist/types/renderers/text.d.ts +3 -0
  469. package/dist/types/types.d.ts +461 -0
  470. package/dist/vue-grid.css +1 -0
  471. package/llms-full.txt +2052 -0
  472. package/llms.txt +23 -0
  473. package/package.json +74 -4
package/llms-full.txt ADDED
@@ -0,0 +1,2052 @@
1
+ # @nocopypaste/vue-grid — guide for coding agents
2
+
3
+ `<VGrid>` is a Vue 3 data grid laid out with CSS Grid (nested rows use `subgrid`). Everything
4
+ beyond a read-only table is an opt-in **feature**, and every cell type is an opt-in **renderer**,
5
+ so an app only bundles what it imports. This file is the shortest path to correct code; the full,
6
+ generated reference is [`agent/api.md`](agent/api.md) (also inside `llms-full.txt`), and
7
+ [`README.md`](README.md) explains each area in depth.
8
+
9
+ Machine-checkable: `validateGridConfig()` from `@nocopypaste/vue-grid/agent` checks a grid config and
10
+ says how to fix each problem; [`agent/grid-config.schema.json`](agent/grid-config.schema.json) is its
11
+ JSON Schema. The `@nocopypaste/vue-grid-mcp` MCP server serves all of this as tools.
12
+
13
+ ## Rules (each one is a bug when skipped)
14
+
15
+ 1. **Import the CSS once**: `import '@nocopypaste/vue-grid/style.css'` (in `main.ts`). Without it the
16
+ grid has no layout.
17
+ 2. **Register every feature an option needs.** `sortable`, `filterable`, `pagination`,
18
+ `selectable`, `sub-rows`, `virtual`, `pinned`, `hidden`, `group`, `aggregate`, `totals`, `group-by`,
19
+ `pinned-rows`, `context-menu`… each needs its feature (table below). Without it the option
20
+ **silently does nothing** (dev builds log a `[vue-grid]` warning naming the feature). Per grid:
21
+ `:features="[sortingFeature, filteringFeature]"`; app-wide: `createVueGrid({ features: [...] })`;
22
+ everything: `allFeatures`. `features` is read once, when the grid is created.
23
+ 3. **Pass renderer definitions**: `renderer: currencyRenderer` (imported). A string name
24
+ (`renderer: 'currency'`) only works after registering it (`createVueGrid({ renderers: [currencyRenderer] })`
25
+ or `:renderers`); unknown names fall back to text with a dev warning.
26
+ 4. **`row-key` is required** and must be unique and stable (a property name or `(row) => id`).
27
+ 5. **Sorting is controlled by default.** `sortable: true` plus `sortingFeature` only updates
28
+ `v-model:sort`. For the grid to sort rows itself, add `sort-mode="client"`.
29
+ 6. **Give the grid a bounded height** (`style="height: 480px"`, or a flex child with
30
+ `min-height: 0`). Sticky headers, pinned rows, virtual scrolling and scroll-into-view need it.
31
+ 7. **Virtual scrolling** needs `virtualScrollingFeature`, `:virtual="{ rowHeight: 40 }"` (every
32
+ row that height, px) and a bounded height. `pagination` is ignored while `virtual` is on.
33
+ 8. **Rows are never mutated** by the grid. To change a cell: assign the field on a reactive row, or
34
+ replace rows (`patchRows(rows, patches, rowKey)` keeps unchanged rows' identity).
35
+ 9. **Editable renderers are controlled** (`checkbox`, `switch`, `radio`, `icon-toggle`, `edit`,
36
+ buttons, menus): they emit `@cell-action="{ name, payload, row, rowKey, column }"`; your handler
37
+ updates the data.
38
+ 10. **Type columns** with `const col = createColumnHelper<Row>()` → `col({ ... })`: `rendererOptions`
39
+ are then checked against the chosen renderer.
40
+ 11. **Server data** (`:data-source` + `serverDataFeature`): don't also pass `rows`; pass the
41
+ `signal` to `fetch`; return `{ rows, total }` (`total` drives the pager).
42
+ 12. Width is any CSS grid track as a **string**: `'8rem'`, `'1fr'`, `'minmax(10rem, 2fr)'`,
43
+ `'min-content'` (default `auto`). Numbers are not accepted.
44
+
45
+ ## Which feature for what
46
+
47
+ | The user wants… | Feature(s) | Props / column options |
48
+ |---|---|---|
49
+ | Click a header to sort | `sortingFeature` | column `sortable: true`; `sort-mode="client"` (or handle `v-model:sort`) |
50
+ | Filters per column, a filter row, quick search | `filteringFeature` | column `filterable: true` (`filter: 'text' \| 'number' \| 'date' \| 'boolean' \| 'set'`); `filter-row`; `<VGridSearch />` in `#toolbar` |
51
+ | Pages | `paginationFeature` | `pagination` (or `{ pageSizes: [10, 25, 50] }`), `v-model:page`, `v-model:page-size` |
52
+ | Backend sorting / filtering / paging | `serverDataFeature` (+ the above) | `:data-source="(query, { signal }) => Promise<{ rows, total }>"` |
53
+ | Checkboxes / row selection, batch actions | `selectionFeature` | `selectable` (or `'single'`), `v-model:selected`, `is-row-selectable`, `prune-selection`; `#toolbar="{ selected, selectedCount, clearSelection }"`; server data: `v-model:select-all-matching` |
54
+ | Nested child rows aligned to the parent's columns | `subGridsFeature` | `:sub-rows="(row) => row.children"` or `:load-sub-rows` + `:has-sub-rows` |
55
+ | An expandable panel under a row | — | `#detail="{ row }"` slot (`row-expandable` to limit it) |
56
+ | 10,000+ rows | `virtualScrollingFeature` | `:virtual="{ rowHeight: 40 }"` + bounded height |
57
+ | Right-click menus (cells, headers) | `menusFeature` | `:context-menu="(ctx) => MenuItem[]"` + `@context-action`; header menu is on by default |
58
+ | Freeze columns left / right | `columnPinningFeature` | column `pinned: 'left' \| 'right'` |
59
+ | Show / hide columns | `columnVisibilityFeature` | column `hidden: true`; `<VGridColumnMenu>` in `#toolbar` |
60
+ | Drag columns to reorder | `columnReorderFeature` | column `reorderable: false` to lock one |
61
+ | Drag column edges to resize | `columnResizingFeature` | `minWidth` / `maxWidth`, `resizable: false` |
62
+ | Grouped headers ("Q1" over three columns) | `columnGroupsFeature` | column `group: 'Q1'` |
63
+ | Rows that stay on top / bottom | `rowPinningFeature` | `v-model:pinned-rows="{ top: [id], bottom: [] }"`, `pinRow()`, `pinned-top-rows` |
64
+ | A totals row (sum, avg, …) | `aggregationFeature` | column `aggregate: 'sum' \| 'avg' \| 'min' \| 'max' \| 'count' \| fn`; `totals` (or `'top'`) |
65
+ | Group rows by a column ("by status, then city") | `rowGroupingFeature` | `v-model:group-by="['status', 'city']"`, `groups-expanded`; column `groupable: true` (header menu), `groupValue: (row) => …` (e.g. month); `aggregate` shows per group |
66
+ | Download CSV, copy rows / cells (Ctrl+C) | `exportFeature` | `grid.exportCsv()`, `getCsv()`, `copyRows()`, `@copy`; column `exportValue`, `exportable: false` |
67
+ | Arrow-key navigation (ARIA grid) | `keyboardNavigationFeature` | — |
68
+ | Remember column layout | — | `storage="orders-grid"` (localStorage key) |
69
+ | Cell type (money, date, badge, link, …) | — | `renderer: currencyRenderer` etc. (list below) |
70
+
71
+ ## Renderers (pick by data)
72
+
73
+ | Data | Renderer export | Useful options |
74
+ |---|---|---|
75
+ | Plain / long text | default (`text`) | `ellipsis`, `lines`, `tone`, `badge`, `copyable`, `tooltip` |
76
+ | Numbers | `numberRenderer` | `format` (Intl), `clickable` |
77
+ | Money | `currencyRenderer` | `currency` (code or `(v, row) => code`) |
78
+ | Up / down change | `changeRenderer` | `direction`, `currency`, `iconOnly` |
79
+ | Dates / date-times | `dateRenderer` / `dateTimeRenderer` | `format`, `twoLines` |
80
+ | Yes / no | `booleanRenderer` | `display: 'icon'`, labels |
81
+ | Status badge | `statusRenderer` | `tone: { Paid: 'success', Open: 'info' }`, `label`, `variant` |
82
+ | Colour chip / tag | `chipRenderer` | `color`, `tone`, `shape` |
83
+ | Links | `linkRenderer` | `href` / `to` (vue-router), `label`, `target` |
84
+ | Several lines in one cell | `multiLineRenderer` | `lines: (v, row) => [...]` |
85
+ | Arrays | `listRenderer` | `max`, `itemLabel` |
86
+ | Images | `imageRenderer` | `src`, `size`, `shape` |
87
+ | JSON / code | `jsonTreeRenderer`, `jsonRenderer`, `codeRenderer` | `collapseAt`, `language` |
88
+ | Badge + info popover | `detailsRenderer` | `items: (v, row) => [{ label, value }]` |
89
+ | Buttons / menus | `actionButtonRenderer`, `buttonGroupRenderer`, `actionsMenuRenderer` | `action`, `buttons`, `actions` |
90
+ | Toggles / inputs (controlled) | `checkboxRenderer`, `switchRenderer`, `radioRenderer`, `iconToggleRenderer`, `editRenderer` | handle `@cell-action` |
91
+ | Copy to clipboard | `copyRenderer` | `copyValue`, `iconOnly` |
92
+
93
+ Every option is in `agent/api.md` → Renderers. Options typed `RowFn` / `RowOption` also take
94
+ `(value, row) => …`. Status / chip / details `tone`s: `success`, `danger`, `warning`, `info`,
95
+ `neutral`, `accent`.
96
+
97
+ ## Recipes
98
+
99
+ ### Basic sortable table
100
+
101
+ ```vue
102
+ <script setup lang="ts">
103
+ import { VGrid, createColumnHelper, currencyRenderer, dateRenderer, sortingFeature, statusRenderer } from '@nocopypaste/vue-grid'
104
+
105
+ interface Order { id: number; customer: { name: string }; total: number; status: 'Paid' | 'Open'; placedAt: string }
106
+ defineProps<{ orders: Order[] }>()
107
+
108
+ const col = createColumnHelper<Order>()
109
+ const columns = [
110
+ col({ key: 'id', header: '#', width: 'min-content' }),
111
+ col({ key: 'customer', header: 'Customer', field: 'customer.name', sortable: true, width: 'minmax(10rem, 1fr)' }),
112
+ col({ key: 'total', header: 'Total', renderer: currencyRenderer, sortable: true }),
113
+ col({ key: 'status', header: 'Status', renderer: statusRenderer, rendererOptions: { tone: { Paid: 'success', Open: 'info' } } }),
114
+ col({ key: 'placedAt', header: 'Placed', renderer: dateRenderer, sortable: true }),
115
+ ]
116
+ </script>
117
+
118
+ <template>
119
+ <VGrid :rows="orders" :columns="columns" row-key="id" :features="[sortingFeature]" sort-mode="client" style="height: 480px" />
120
+ </template>
121
+ ```
122
+
123
+ ### Filters, quick search, column picker and saved layout
124
+
125
+ ```vue
126
+ <script setup lang="ts">
127
+ import {
128
+ VGrid, VGridColumnMenu, VGridSearch,
129
+ columnVisibilityFeature, filteringFeature, sortingFeature, type FilterState,
130
+ } from '@nocopypaste/vue-grid'
131
+ const filters = ref<FilterState | null>(null)
132
+ // columns: add `filterable: true` (type from the renderer, or `filter: 'date'` etc.)
133
+ </script>
134
+
135
+ <template>
136
+ <VGrid v-model:filters="filters" :rows="rows" :columns="columns" row-key="id" filter-row sort-mode="client"
137
+ storage="orders-grid" filter-storage="orders-filters"
138
+ :features="[sortingFeature, filteringFeature, columnVisibilityFeature]" style="height: 480px">
139
+ <template #toolbar="{ columnState, setColumnState, activeFilterCount, clearFilters }">
140
+ <VGridSearch />
141
+ <button v-if="activeFilterCount" @click="clearFilters()">Clear {{ activeFilterCount }}</button>
142
+ <VGridColumnMenu :columns="columns" :column-state="columnState" @update:column-state="setColumnState($event!)" />
143
+ </template>
144
+ </VGrid>
145
+ </template>
146
+ ```
147
+
148
+ ### Server data with paging
149
+
150
+ ```ts
151
+ import { filteringFeature, paginationFeature, serverDataFeature, sortingFeature, type DataSource } from '@nocopypaste/vue-grid'
152
+
153
+ const fetchOrders: DataSource<Order> = async (query, { signal }) => {
154
+ // query: { sort: { key, dir } | null, filters: { columns, search }, page, pageSize }
155
+ const res = await fetch('/api/orders/search', { method: 'POST', body: JSON.stringify(query), signal })
156
+ if (!res.ok) throw new Error(res.statusText) // the grid shows an error with Retry, emits load-error
157
+ return res.json() as Promise<{ rows: Order[]; total: number }>
158
+ }
159
+ ```
160
+
161
+ ```vue
162
+ <VGrid :data-source="fetchOrders" :columns="columns" row-key="id" pagination filter-row
163
+ :features="[serverDataFeature, sortingFeature, filteringFeature, paginationFeature]" style="height: 520px" />
164
+ ```
165
+
166
+ Server totals: pass them as `:aggregates="{ total: 125000 }"` with `totals` and `aggregationFeature`.
167
+
168
+ ### Tree: nested and lazy child rows
169
+
170
+ ```vue
171
+ <!-- synchronous children -->
172
+ <VGrid :rows="markets" :columns="columns" row-key="id" :sub-rows="(m) => m.children" :features="[subGridsFeature]" />
173
+ <!-- lazy children, fetched on first expand -->
174
+ <VGrid :rows="folders" :columns="columns" row-key="id" :load-sub-rows="loadChildren" :has-sub-rows="(f) => f.hasChildren"
175
+ v-model:expanded="expanded" :features="[subGridsFeature]" />
176
+ ```
177
+
178
+ Children share the parent's columns. For a different set of columns, use the `#detail` slot with
179
+ another `<VGrid>` inside.
180
+
181
+ ### Detail row
182
+
183
+ ```vue
184
+ <VGrid :rows="orders" :columns="columns" row-key="id">
185
+ <template #detail="{ row }"><OrderLines :order-id="row.id" /></template>
186
+ </VGrid>
187
+ ```
188
+
189
+ ### Selection and batch actions
190
+
191
+ ```vue
192
+ <VGrid v-model:selected="selected" :rows="rows" :columns="columns" row-key="id" selectable prune-selection
193
+ :is-row-selectable="(r) => r.status !== 'locked'" :features="[selectionFeature]">
194
+ <template #toolbar="{ selected, selectedCount, clearSelection }">
195
+ <span v-if="selectedCount">{{ selectedCount }} selected
196
+ <button @click="approve(selected).then(clearSelection)">Approve</button></span>
197
+ </template>
198
+ </VGrid>
199
+ ```
200
+
201
+ Don't build a checkbox column with a renderer and your own `ref` of ids: `selectable` gives the
202
+ column, select-all, shift-click ranges, disabled rows and keyboard support. With `data-source`,
203
+ the banner's "Select all N rows" sets `v-model:select-all-matching`; act on the query then.
204
+
205
+ ### 10,000+ rows
206
+
207
+ ```vue
208
+ <VGrid :rows="bigList" :columns="columns" row-key="id" :virtual="{ rowHeight: 40 }" sort-mode="client"
209
+ :features="[virtualScrollingFeature, sortingFeature]" style="height: 600px" />
210
+ ```
211
+
212
+ ### Totals and pinned rows
213
+
214
+ ```ts
215
+ const columns = [
216
+ col({ key: 'customer', aggregate: 'count' }),
217
+ col({ key: 'total', renderer: currencyRenderer, aggregate: 'sum' }),
218
+ ]
219
+ const pinned = ref<PinnedRowsState>({ top: [42] })
220
+ ```
221
+
222
+ ```vue
223
+ <VGrid ref="grid" v-model:pinned-rows="pinned" :rows="rows" :columns="columns" row-key="id" totals
224
+ :features="[aggregationFeature, rowPinningFeature]" style="height: 480px" />
225
+ <!-- grid.value.pinRow(key, 'top' | 'bottom' | null) from your own button or context menu -->
226
+ ```
227
+
228
+ ### Row grouping
229
+
230
+ ```ts
231
+ const columns = [
232
+ col({ key: 'customer', field: 'customer.name' }),
233
+ col({ key: 'status', renderer: statusRenderer, groupable: true }),
234
+ col({ key: 'placedAt', renderer: dateRenderer, groupable: true, groupValue: (o) => o.placedAt.slice(0, 7) }),
235
+ col({ key: 'total', renderer: currencyRenderer, aggregate: 'sum' }), // shown in every group row
236
+ ]
237
+ const groupBy = ref(['status'])
238
+ ```
239
+
240
+ ```vue
241
+ <VGrid v-model:group-by="groupBy" :rows="orders" :columns="columns" row-key="id" sort-mode="client"
242
+ :features="[rowGroupingFeature, sortingFeature, menusFeature]" style="height: 480px" />
243
+ ```
244
+
245
+ Groups start collapsed (`groups-expanded` to open them); the group label sits in the first
246
+ visible column, so keep that column wide enough (or give the next columns no `aggregate`, so the
247
+ label runs across them). `#group-<key>="{ value, count }"` renders a group's value yourself.
248
+
249
+ ### CSV export and copy
250
+
251
+ ```vue
252
+ <script setup lang="ts">
253
+ import { exportFeature, keyboardNavigationFeature, selectionFeature, type VGridExposed } from '@nocopypaste/vue-grid'
254
+ const grid = ref<VGridExposed>()
255
+ // columns: `exportable: false` on action columns; `exportValue: (row) => row.id` where the cell isn't the data
256
+ </script>
257
+
258
+ <template>
259
+ <button @click="grid?.exportCsv({ filename: 'orders.csv' })">Download CSV</button>
260
+ <button @click="grid?.copyRows()">Copy selected</button>
261
+ <VGrid ref="grid" :rows="orders" :columns="columns" row-key="id" selectable
262
+ :features="[exportFeature, selectionFeature, keyboardNavigationFeature]" @copy="(e) => notify(e.text)" />
263
+ </template>
264
+ ```
265
+
266
+ `exportCsv` / `getCsv` default to the filtered, sorted rows on every page, the visible columns and
267
+ raw values; `copyRows` and Ctrl/⌘+C to the selected rows as displayed, tab-separated. Options:
268
+ `rows: 'filtered' | 'all' | 'page' | 'selected'`, `columns: [keys]`, `values: 'raw' | 'formatted'`,
269
+ `header`, `totals`, `children`, `delimiter`. `toCsv(rows, columns)` works without a grid.
270
+
271
+ ### Row actions and context menu
272
+
273
+ ```vue
274
+ <script setup lang="ts">
275
+ import { actionsMenuRenderer, menusFeature, type CellActionEvent, type CellContext, type MenuItem } from '@nocopypaste/vue-grid'
276
+ const columns = [
277
+ /* … */
278
+ col({ key: 'actions', header: '', width: 'min-content', renderer: actionsMenuRenderer,
279
+ rendererOptions: { actions: [{ name: 'edit', label: 'Edit' }, { separator: true }, { name: 'delete', label: 'Delete', tone: 'danger' }] } }),
280
+ ]
281
+ const cellMenu = (ctx: CellContext<Order>): MenuItem[] => [{ name: 'copy', label: `Copy ${ctx.column.header}` }]
282
+ function onAction(e: CellActionEvent<Order>) { if (e.name === 'delete') remove(e.rowKey) }
283
+ </script>
284
+
285
+ <template>
286
+ <VGrid :rows :columns row-key="id" :context-menu="cellMenu" :features="[menusFeature]"
287
+ @cell-action="onAction" @context-action="(e) => copy(String(e.value))" />
288
+ </template>
289
+ ```
290
+
291
+ ### Editable checkbox (controlled)
292
+
293
+ ```ts
294
+ col({ key: 'active', renderer: switchRenderer })
295
+ // <VGrid … @cell-action="(e) => { if (e.column.key === 'active') e.row.active = e.payload }" />
296
+ ```
297
+
298
+ ### Your own renderer
299
+
300
+ ```ts
301
+ import { defineCellRenderer } from '@nocopypaste/vue-grid'
302
+ import RatingCell from './RatingCell.vue' // props: CellRendererProps<Row, number, { max?: number }>; emit('action', 'rate', n)
303
+ export const ratingRenderer = defineCellRenderer<{ max?: number }>({ name: 'rating', component: RatingCell, defaults: { max: 5 } })
304
+ // column: { key: 'rating', renderer: ratingRenderer, rendererOptions: { max: 10 } }
305
+ ```
306
+
307
+ ### Theming
308
+
309
+ ```css
310
+ .my-grid { --vg-color-accent: #db2777; --vg-radius: 1rem; --vg-font-size: 0.8125rem; }
311
+ ```
312
+
313
+ Tokens: `--vg-*` (see README → Theming). Dark mode follows `color-scheme`. Density:
314
+ `density="compact" | "cozy" | "comfortable"`. Utility classes per part: `:ui="{ cell: 'px-2' }"`.
315
+
316
+ ## Check your work
317
+
318
+ 1. Validate the config: `validateGridConfig({ columns, rowKey: 'id', features: ['sortingFeature'], sortMode: 'client' })`
319
+ from `@nocopypaste/vue-grid/agent` (or the MCP tool `vue_grid_validate`). Fix every `error`; read the
320
+ `warning`s.
321
+ 2. Run the app in dev mode and read the console: `[vue-grid]` warnings name a missing feature, an
322
+ unknown renderer or a duplicate row key.
323
+ 3. Look at it in a browser: the header sticks, rows scroll inside the grid, the features you added
324
+ respond (sort a column, open a filter, expand a row).
325
+
326
+ ## Pitfalls
327
+
328
+ - Nothing sorts → `sort-mode="client"` missing (or `sortingFeature` missing).
329
+ - Columns are squeezed / the page scrolls sideways → give `width`s (`minmax(8rem, 1fr)`); the grid
330
+ scrolls horizontally inside itself when columns are wider than it.
331
+ - Grid grows forever / no sticky header → no bounded height.
332
+ - The page scrolls sideways on a phone → an element you wrapped the grid in sits in a flex or grid
333
+ layout without `min-width: 0` (so it grows to the columns' width). Add `min-width: 0` to it;
334
+ `<VGrid>`'s own root already has it.
335
+ - `renderer: 'currency'` shows plain text → the renderer isn't registered; import and pass `currencyRenderer`.
336
+ - Changing `:features` later does nothing → features are read at creation; re-create with `:key`.
337
+ - Virtual grid with variable row content → rows must share `rowHeight`; use `lines`/`ellipsis` to keep them uniform.
338
+ - `dataSource` plus `rows` → `rows` is ignored with a data source.
339
+ - A nested child with different columns → not a sub-grid; use `#detail` with another `<VGrid>`.
340
+ - One group per date or timestamp → group by a coarser value: `groupValue: (row) => row.date.slice(0, 7)`.
341
+ - Ctrl+C copies nothing for a clicked cell → cells only take focus with `keyboardNavigationFeature`
342
+ (or select rows first); `exportFeature` must be registered too.
343
+ - An exported column of `⋯` / buttons / `[object Object]` → `exportable: false`, or `exportValue: (row) => …`.
344
+ - Copied numbers come out as `€1,234.50` → copying uses displayed values; pass `{ values: 'raw' }`
345
+ (CSV exports are raw by default).
346
+ - `group-by` names a field, not a column → it takes column `key`s; add a (hidden) column for it.
347
+ - `selected` still holds deleted or reloaded rows' keys → add `prune-selection` (keys are kept by
348
+ default so a selection can span server pages).
349
+ - A batch action on "Select all N rows" only touched one page → check `selectAllMatching` and act on
350
+ the query, not on `selected` (which holds the loaded rows only).
351
+
352
+ ---
353
+
354
+ # @nocopypaste/vue-grid 0.3.0 — API reference
355
+
356
+ > Generated from the TypeScript sources (`scripts/gen-agent.mjs`). Machine-readable: `agent/api.json`, `agent/grid-config.schema.json`.
357
+
358
+ ## Features
359
+
360
+ Opt-in: pass them as `:features="[…]"` on `<VGrid>` or once via `createVueGrid({ features })` (`allFeatures` = all). An option whose feature is missing does nothing.
361
+
362
+ | Export | What it enables | Props | Column options |
363
+ |---|---|---|---|
364
+ | `aggregationFeature` | Aggregates and the totals row: columns with an `aggregate` (`sum`, `avg`, `min`, `max`, `count` or a function) and `totals` (`true` / `'bottom'` or `'top'`) show a sticky totals row over the rows that pass the filters, on every page. `aggregates` supplies the values instead (e.g. from a server). Without it, `aggregate` and `totals` are ignored. | `totals` `totalsLabel` `aggregates` | `aggregate` |
365
+ | `columnGroupsFeature` | Grouped column headers: give columns a `group` and adjacent visible columns of the same group get one header cell spanning them, in a sticky row above the column headers. Groups follow reordering, hiding and pinning (a pin boundary splits a group). Without it, `group` is ignored. | | `group` |
366
+ | `columnPinningFeature` | Pinned columns: `pinned: 'left' \| 'right'` columns stay put (sticky) while the grid scrolls sideways, with edge shadows; runtime pins from the header menu (Pin left / Pin right / Unpin) are kept in `v-model:column-state` and persisted with `storage`. Without it, pins are ignored. | | `pinned` `pinnable` |
367
+ | `columnReorderFeature` | Column reordering: drag a header (mouse, pen, touch), Alt+←/→ on a focused header, and the header menu's Move left / Move right. Columns opt out with `reorderable: false`. The order is part of `v-model:column-state` and persisted with `storage`; `<VGridColumnMenu>` works without it. | | `reorderable` |
368
+ | `columnResizingFeature` | Column resizing: drag a header's edge (mouse, pen, touch), use ←/→ on the focused edge (Alt+Shift+←/→ on a header with keyboard navigation), or double-click the edge to fit the content. `minWidth` / `maxWidth` bound it; columns opt out with `resizable: false`. Widths are kept in `columnState.widths` and persisted with `storage`. The header menu gains Fit width / Reset width. | | `maxWidth` `resizable` |
369
+ | `columnVisibilityFeature` | Column visibility: `hidden: true` columns, `columnState.hidden` (persisted with `storage`), the header menu's Hide column item and `<VGridColumnMenu>`'s checkboxes. Columns opt out with `hideable: false`. Without it, every column shows. | | `hidden` `hideable` |
370
+ | `exportFeature` | CSV export and copying: `grid.exportCsv()` downloads the filtered, sorted rows as a CSV file, `grid.getCsv()` returns the text, `grid.copyRows()` copies rows as tab-separated text, and Ctrl/⌘+C copies the selected rows, else the focused cell, as displayed. Columns can set `exportValue` and `exportable: false`. Without it those methods only warn. | | `exportValue` `exportable` |
371
+ | `filteringFeature` | Filtering: header funnels with typed filter popovers on `filterable` columns, the filter row, `<VGridSearch>`, the filter items of the header menu, `v-model:filters` and filter persistence. The popover body and the filter-row editors load on demand (own chunks). | `filterMode` `filterRow` `filterStorage` `noMatchText` `filters` | `filterable` `filter` `filterValue` `filterFn` `filterComponent` `searchable` |
372
+ | `keyboardNavigationFeature` | Keyboard navigation (the ARIA grid pattern): the grid is one tab stop, arrow keys / Home / End / PageUp / PageDown move between cells, Enter activates a cell's control, Space selects a row, →/← expand and collapse, Alt+←/→ move a column, ContextMenu / Shift+F10 open the cell menu. Without it the grid is an ARIA `table`: its own controls (sort buttons, expanders, checkboxes, filter buttons) sit in the normal Tab order instead. | | |
373
+ | `menusFeature` | Context menus: the built-in header menu (sort, filter, pin, move, hide, reset, your own items via `header-menu`) and body-cell menus (`context-menu`), opened by right-click, the ContextMenu key or Shift+F10. Without it the browser's own menu shows. The standalone `<VGridMenu>` and the `actions-menu` renderer don't need it. | `contextMenu` `headerMenu` | |
374
+ | `paginationFeature` | Built-in pagination: the `pagination` prop and `v-model:page` / `v-model:page-size`. Pages the client rows, or asks the `dataSource` for pages. The pager loads on demand (own chunk). Not needed for the standalone `<VGridPagination>` component. | `pagination` `page` `pageSize` | |
375
+ | `rowGroupingFeature` | Row grouping: `v-model:group-by="['region', 'status']"` groups the rows by those columns into collapsible group rows with their value, row count and the aggregates of columns with an `aggregate`. Columns with `groupable: true` get Group by / Ungroup items in the header menu. Without it, `group-by` is ignored. | `groupsExpanded` `groupBy` | `groupable` `groupValue` |
376
+ | `rowPinningFeature` | Pinned rows: `v-model:pinned-rows` (`{ top, bottom }` row keys), `pinned-top-rows` / `pinned-bottom-rows` (extra rows that aren't in the data) and the `pinRow()` method. Pinned rows stay in view (sticky) under the header or at the bottom while the body scrolls, and aren't filtered, sorted or paged. Without it, those options are ignored. | `pinnedTopRows` `pinnedBottomRows` `pinnedRows` | |
377
+ | `selectionFeature` | Row selection: the `selectable` prop (multi or single), `v-model:selected`, `selection-mode` (cascade through sub-grids), `is-row-selectable`, Space on a row, shift-click (or Shift+Space) for a range, the select-all checkbox, `prune-selection`, and with server data a "select all N matching rows" banner (`v-model:select-all-matching`; it loads on demand, its own chunk). | `selectable` `selectionMode` `isRowSelectable` `pruneSelection` `selected` `selectAllMatching` | |
378
+ | `serverDataFeature` | Server data: the `dataSource` prop. The grid sends sort, filters and page to your function, cancels superseded requests, and shows loading, error and retry states. | `dataSource` | |
379
+ | `sortingFeature` | Sorting: the sort button on `sortable` column headers, the sort items of the header menu and, with `sort-mode="client"`, sorting the rows in the browser. | | `sortable` `sortValue` `sortFn` |
380
+ | `subGridsFeature` | Sub-grids: nested child rows in a CSS `subgrid`, from `sub-rows` (synchronous) or `load-sub-rows` (lazy, cached, with loading / error / retry). Detail rows (`#detail` slot) don't need it. | `subRows` `loadSubRows` `hasSubRows` | |
381
+ | `virtualScrollingFeature` | Virtual scrolling: `:virtual="{ rowHeight, overscan?, detailHeight? }"` renders only the rows in view (plus `overscan`), so tens of thousands of rows stay fast — sub-grids and detail rows included, inside the same CSS grid / subgrid layout. Without it, `virtual` is ignored and every row renders. | `virtual` | |
382
+
383
+ ## `<VGrid>` props
384
+
385
+ | Prop | Type | Default | Needs | Description |
386
+ |---|---|---|---|---|
387
+ | `rows` | `readonly T[]` | `[]` | | The rows (client data), used as-is and never mutated. Omit when using `dataSource`. |
388
+ | `columns` (required) | `readonly ColumnDef<T>[]` | | | Column definitions, in default display order (see `ColumnDef`). |
389
+ | `rowKey` (required) | `RowKeyGetter<T>` | | | Stable unique id of a row: a property name or `(row) => string \| number`. All row state is keyed by it. |
390
+ | `features` | `readonly GridFeature[]` | | | Opt-in features for this grid (added to the app-wide `createVueGrid({ features })`): `sortingFeature`, `filteringFeature`, `serverDataFeature`, `paginationFeature`, or `allFeatures`. Read once, when the grid is created. |
391
+ | `dataSource` | `DataSource<T>` | | `serverDataFeature` | Server data: called with the current query (sort, filters, search, page) whenever it changes. The grid cancels superseded requests, shows loading and errors, and sorts / filters / pages nothing itself. |
392
+ | `pagination` | `boolean \| { pageSizes?: number[] }` | `false` | `paginationFeature` | Built-in pagination under the grid (server-side with `dataSource`, client-side otherwise). |
393
+ | `sortMode` | `'controlled' \| 'client'` | `'controlled'` | | `controlled` (default): a header click only updates `v-model:sort` (sort on the server or in your own code). `client`: the grid sorts the rows itself. Ignored with `dataSource`. |
394
+ | `filterMode` | `'client' \| 'controlled'` | `'client'` | `filteringFeature` | `client` (default): the grid filters its rows. `controlled`: it only emits `update:filters`. |
395
+ | `filterRow` | `boolean` | `false` | `filteringFeature` | Show the filter row: an input under each filterable column's header. |
396
+ | `filterStorage` | `FilterStateStorage \| string` | | `filteringFeature` | Persist the filter model (`string` = localStorage key). |
397
+ | `noMatchText` | `string` | `'No rows match the current filters.'` | `filteringFeature` | Shown when filters hide every row. |
398
+ | `selectable` | `boolean \| 'single'` | `false` | `selectionFeature` | A selection column: `true` = multi-select (with select-all), `'single'` = one row. |
399
+ | `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | `selectionFeature` | `cascade` (default): selecting a parent selects its children. `independent`: rows alone. |
400
+ | `isRowSelectable` | `(row: T) => boolean` | | `selectionFeature` | Rows that can't be selected get a disabled checkbox. |
401
+ | `pruneSelection` | `boolean` | `false` | `selectionFeature` | Drop selected keys whose rows are no longer in the data (after a reload, a delete, a new server page). Default: keys are kept, so a selection can span server pages. |
402
+ | `subRows` | `(row: T) => T[] \| undefined \| null` | | `subGridsFeature` | Synchronous child rows of a row: shown in a nested sub-grid when expanded. |
403
+ | `loadSubRows` | `(row: T) => Promise<T[]>` | | `subGridsFeature` | Lazy child rows, loaded on first expand (cached, with loading / error / retry). |
404
+ | `hasSubRows` | `(row: T) => boolean` | | `subGridsFeature` | With `loadSubRows`: which rows get an expander (default: every row). |
405
+ | `rowExpandable` | `(row: T) => boolean` | | | With a `#detail` slot: which rows can expand to show it (default: every row). |
406
+ | `rowClickable` | `boolean` | `false` | | Pointer cursor on rows (`row-click` is emitted either way). |
407
+ | `rowClass` | `(row: T, index: number) => ClassValue` | | | Extra classes for a row. |
408
+ | `highlightedRows` | `readonly RowKey[]` | | | Keys of rows to highlight (e.g. the row being edited). |
409
+ | `flash` | `FlashMode` | | | Briefly highlight cells whose value changes (live data, enrichment). Columns can override. |
410
+ | `virtual` | `VirtualOptions \| false` | `false` | `virtualScrollingFeature` | Virtual scrolling: only the rows in view render. Rows share one height (`rowHeight`, px) and the grid needs a bounded height. Needs the virtual scrolling feature. |
411
+ | `storage` | `ColumnStateStorage \| string` | | | Persist column state (order, hidden, pins, widths): a localStorage key or your own storage. |
412
+ | `renderers` | `CellRendererDefinition[]` | | | Renderers usable by name in this grid (merged over the app-wide ones). |
413
+ | `locale` | `string` | | | Locale for number / date renderers (default: the plugin's, else the browser's). |
414
+ | `currency` | `string` | | | Default ISO 4217 currency for currency renderers. |
415
+ | `timeZone` | `string` | | | IANA time zone for date renderers and date filters. |
416
+ | `density` | `Density` | | | Cell padding scale. |
417
+ | `loading` | `boolean` | `false` | | Shows a progress bar and sets `aria-busy` (server data sets it by itself). |
418
+ | `emptyText` | `string` | `'No data to show.'` | | Shown when there are no rows. |
419
+ | `ariaLabel` | `string` | | | Accessible name of the grid. |
420
+ | `ui` | `Partial<Record<GridPart, ClassValue>>` | | | Extra classes per part (`root`, `header`, `headerCell`, `row`, `cell`, `subgrid`, `detail`, `empty`), e.g. Tailwind utilities. |
421
+ | `contextMenu` | `(ctx: CellContext<T>) => MenuItem[] \| null \| undefined` | | `menusFeature` | Right-click menu items for a body cell. Return `null`/`[]` to keep the browser's menu. |
422
+ | `headerMenu` | `boolean \| ((ctx: HeaderMenuContext<T>) => MenuItem[] \| null \| undefined)` | `true` | `menusFeature` | Header right-click menu: `true` = built-in items (sort, pin, move, hide, reset), `false` = off, or a function that receives the built-in items and returns the items to show. |
423
+ | `pinnedTopRows` | `readonly T[]` | | `rowPinningFeature` | Extra rows above the body, not part of the data (row pinning feature). |
424
+ | `pinnedBottomRows` | `readonly T[]` | | `rowPinningFeature` | Extra rows below the body, not part of the data (row pinning feature). |
425
+ | `totals` | `boolean \| 'top' \| 'bottom'` | `false` | `aggregationFeature` | A totals row with each column's `aggregate` (aggregation feature): `true` / `'bottom'` sticks it to the bottom, `'top'` under the header. |
426
+ | `totalsLabel` | `string` | `'Total'` | `aggregationFeature` | The totals row's label, in its first column (unless that column has an aggregate). |
427
+ | `aggregates` | `Record<string, unknown>` | | `aggregationFeature` | Totals row values by column key, instead of computing them (e.g. totals from a server). |
428
+ | `groupsExpanded` | `boolean` | `false` | `rowGroupingFeature` | Groups start expanded (row grouping feature). Default: collapsed. |
429
+
430
+ ## `v-model`s
431
+
432
+ | Model | Type | Default | Needs | Description |
433
+ |---|---|---|---|---|
434
+ | `v-model:sort` | `SortState \| null` | `null` | | Sort state: a header click cycles asc → desc → none. Header UI needs the sorting feature. |
435
+ | `v-model:columnState` | `ColumnState \| undefined` | `undefined` | | Column order, hidden columns, runtime pins and resized widths (persisted with `storage`). |
436
+ | `v-model:expanded` | `RowKey[]` | `[]` | | Keys of expanded rows (sub-grids and detail rows). |
437
+ | `v-model:selected` | `RowKey[]` | `[]` | `selectionFeature` | Keys of selected rows. Needs the selection feature. |
438
+ | `v-model:filters` | `FilterState \| null` | `null` | `filteringFeature` | Column filters and quick search: `{ columns: Record<key, ColumnFilter>, search }`. Needs the filtering feature. |
439
+ | `v-model:page` | `number` | `1` | `paginationFeature` | Current page (1-based); resets to 1 when sort or filters change. Needs the pagination feature. |
440
+ | `v-model:pageSize` | `number` | `25` | `paginationFeature` | Rows per page. Needs the pagination feature. |
441
+ | `v-model:pinnedRows` | `PinnedRowsState \| null` | `null` | `rowPinningFeature` | Top-level rows pinned above / below the body, by key: `{ top, bottom }`. Needs the row pinning feature. |
442
+ | `v-model:groupBy` | `readonly string[] \| string \| null` | `null` | `rowGroupingFeature` | Column keys to group the rows by, outermost first (`['region', 'status']`, or one key). Group rows show the value, the row count and the columns' aggregates. Needs the row grouping feature. |
443
+ | `v-model:selectAllMatching` | `boolean` | `false` | `selectionFeature` | Server data: every row matching the query is selected, not just the loaded ones (set from the "Select all N rows" banner; ends when filters change or a row is unticked). Act on the query then, not on `selected`. Needs the selection feature. |
444
+
445
+ ## Events
446
+
447
+ | Event | Payload | Description |
448
+ |---|---|---|
449
+ | `query-change` | `[query: GridQuery]` | The combined query (sort, filters, search, page) — on mount and whenever it changes. |
450
+ | `load-error` | `[error: unknown]` | A `dataSource` call failed (the grid shows an error with Retry). |
451
+ | `row-click` | `[row: T, event: MouseEvent \| KeyboardEvent]` | A row was clicked (not on a link, button or input inside it, nor a `clickable` column). |
452
+ | `cell-click` | `[event: CellClickEvent<T>]` | A cell of a `clickable: true` column was clicked. |
453
+ | `cell-action` | `[event: CellActionEvent<T>]` | A renderer emitted an action (buttons, toggles, menus, edit, copy). |
454
+ | `sub-rows-error` | `[event: { row: T; error: unknown }]` | `loadSubRows` rejected for a row. |
455
+ | `context-action` | `[event: ContextActionEvent<T>]` | An item of the body-cell context menu was chosen. |
456
+ | `header-action` | `[event: HeaderActionEvent<T>]` | A custom item of the header menu was chosen (built-in items act by themselves). |
457
+ | `copy` | `[event: CopyEvent<T>]` | Rows or a cell were copied to the clipboard (export feature: `copyRows()`, Ctrl/⌘+C). |
458
+
459
+ ## Slots
460
+
461
+ | Slot | Scope | Description |
462
+ |---|---|---|
463
+ | `cell-<key>` | `{ row: T; value: unknown; rowKey: RowKey; rowIndex: number; depth: number; column: ColumnDef<T> }` | A column's body cell, replacing its renderer: `#cell-<key>`. |
464
+ | `header-<key>` | `{ column: ColumnDef<T> }` | A column's header content: `#header-<key>`. |
465
+ | `total-<key>` | `{ value: unknown; column: ColumnDef<T>; group?: RowGroup<T> }` | A column's cell in the totals row and in group rows (aggregation, row grouping); `group` in group rows. |
466
+ | `group-<key>` | `{ value: unknown; count: number; rows: readonly T[]; column: ColumnDef<T>; group: RowGroup<T> }` | The value of a group row grouped by this column (row grouping feature): `#group-<key>`. |
467
+ | `detail` | `{ row: T; rowKey: RowKey; depth: number }` | Expandable detail row under a row: any content, even another grid. |
468
+ | `empty` | | Shown when there are no rows. |
469
+ | `loading` | | Shown while loading with no rows yet. |
470
+ | `sub-rows-loading` | `{ row: T }` | Shown while a row's lazy children load. |
471
+ | `toolbar` | `{ columns: readonly ColumnDef<T>[]; columnState: ColumnState; setColumnState: (state: ColumnState) => void; filters: FilterState; setFilters: (state: FilterState) => void; clearFilters: () => void; activeFilterCount: number; selected: readonly RowKey[]; selectedCount: number; selectAllMatching: boolean; clearSelection: () => void }` | Above the grid: put a search box, column menu, filter summary or batch actions here. |
472
+
473
+ ## Exposed methods (`ref<VGridExposed>()`)
474
+
475
+ | Method | Signature | Needs | Description |
476
+ |---|---|---|---|
477
+ | `scrollToTop` | `void` | | Scrolls the grid back to its first row. |
478
+ | `scrollToRow` | `void` | | Scrolls a row (top-level or nested, also in virtual mode) into view. |
479
+ | `expandAll` | `void` | | Expands every expandable row (sub-grids and detail rows) that passes the filters. |
480
+ | `collapseAll` | `void` | | Collapses every row. |
481
+ | `setColumnState` | `void` | | Replaces the column state (order, hidden, pins, widths), and saves it with `storage`. |
482
+ | `patchLoadedRows` | `number` | | Applies field patches to lazily loaded child rows (`loadSubRows`), which the grid caches and the app can't reach. Top-level and synchronous `subRows` data belong to the app: update them there (assign fields on reactive rows, or use `patchRows`). Returns the number of rows patched. |
483
+ | `setFilters` | `void` | `filteringFeature` | Replaces the filter model (also persisted with `filter-storage`). |
484
+ | `clearFilters` | `void` | `filteringFeature` | Removes every column filter and the search. |
485
+ | `openFilter` | `void` | `filteringFeature` | Opens a column's filter popover. |
486
+ | `reload` | `Promise<void>` | `serverDataFeature` | Re-runs the `dataSource` with the current query; lazily loaded child rows load again too. |
487
+ | `reloadSubRows` | `void` | | Forgets lazily loaded child rows (one row's, or all): expanded rows load them again. |
488
+ | `pinRow` | `void` | `rowPinningFeature` | Pins a top-level row above or below the body, or unpins it (`null`). Row pinning feature. |
489
+ | `clearSelection` | `void` | | Clears the selection, "all matching rows" included. Selection feature. |
490
+ | `getCsv` | `string` | | The rows as CSV text: the filtered, sorted rows, visible columns, raw values. Export feature. |
491
+ | `exportCsv` | `void` | | Downloads the rows as a CSV file (`filename`, default `export.csv`; UTF-8 with a BOM). Export feature. |
492
+ | `copyRows` | `Promise<boolean>` | | Copies rows to the clipboard as tab-separated text (pastes as cells into spreadsheets): the selected rows by default, as displayed, no header. Resolves `false` if nothing was copied. Export feature. |
493
+
494
+ ## `ColumnDef<T>`
495
+
496
+ | Option | Type | Needs | Description |
497
+ |---|---|---|---|
498
+ | `key` (required) | `string` | | Unique, stable column id. Also used for sort state, column state and slot names. |
499
+ | `header` | `string` | | Header text (default: the key). |
500
+ | `headerTooltip` | `string` | | Tooltip on the header cell. |
501
+ | `field` | `string` | | Dot path into the row, e.g. `user.address.city`. Defaults to `key`. |
502
+ | `value` | `(row: T) => unknown` | | Computes the cell value; wins over `field`. |
503
+ | `renderer` | `R \| Component` | | A renderer definition (`currencyRenderer`), a registered renderer name, or a component. Defaults to `text`. |
504
+ | `rendererOptions` | `RendererOptions<R>` | | Options of the column's renderer, typed against it (merged over the renderer's defaults). |
505
+ | `width` | `string` | | Any CSS grid track size. Defaults to `auto`. |
506
+ | `minWidth` | `string` | | Lower bound; combined with `width` into `minmax(minWidth, width)`, and the resize minimum. |
507
+ | `maxWidth` | `string` | `columnResizingFeature` | Upper bound when the user resizes the column (column resizing feature). |
508
+ | `resizable` | `boolean` | `columnResizingFeature` | Can the user resize this column (column resizing feature)? Default `true`. |
509
+ | `group` | `string` | `columnGroupsFeature` | Header group label (column groups feature): adjacent visible columns with the same `group` share one header cell above their own headers. |
510
+ | `align` | `Align` | | Cell and header alignment (default: the renderer's, e.g. `end` for numbers, else `start`). |
511
+ | `sortable` | `boolean` | `sortingFeature` | A sort button in the header (sorting feature). Client sorting needs `sort-mode="client"`. |
512
+ | `sortValue` | `(row: T) => unknown` | `sortingFeature` | The value client sorting compares (default: the renderer's sort value, else the cell value). |
513
+ | `sortFn` | `(a: T, b: T) => number` | `sortingFeature` | A full comparator for client sorting; wins over `sortValue`. |
514
+ | `pinned` | `PinSide` | `columnPinningFeature` | Initial pin side (the header menu can change it at runtime unless `pinnable: false`). |
515
+ | `pinnable` | `boolean` | `columnPinningFeature` | Can the user pin/unpin it from the header menu? Default `true`. |
516
+ | `hidden` | `boolean` | `columnVisibilityFeature` | Initial visibility (column state wins once it exists). |
517
+ | `hideable` | `boolean` | `columnVisibilityFeature` | Can the user hide it from the column menu? Default `true`. |
518
+ | `reorderable` | `boolean` | `columnReorderFeature` | Can the user move it? Default `true`. |
519
+ | `clickable` | `boolean` | | Cell click emits `cell-click` instead of `row-click`. |
520
+ | `filterable` | `boolean` | `filteringFeature` | Show a filter for this column (funnel in the header, and an input in the filter row). |
521
+ | `filter` | `FilterType \| ColumnFilterOptions` | `filteringFeature` | Filter type — default from the renderer (number, date, boolean, set for status/chip, else text) — or options. |
522
+ | `filterValue` | `(row: T) => unknown` | `filteringFeature` | Value used for filtering (default: the cell value). |
523
+ | `filterFn` | `(row: T, filter: ColumnFilter, value: unknown) => boolean` | `filteringFeature` | Custom predicate; replaces the built-in matching for this column. |
524
+ | `filterComponent` | `Component` | `filteringFeature` | Custom filter UI (popover), receives `modelValue` / emits `update:modelValue` with a filter. |
525
+ | `searchable` | `boolean` | `filteringFeature` | Include in the quick search. Default `true` for visible columns. |
526
+ | `flash` | `FlashMode` | | Briefly highlight the cell when its value changes (overrides the grid's `flash` prop). `'direction'`: green when a number goes up, red when it goes down. |
527
+ | `aggregate` | `AggregateName \| AggregateFn<T>` | `aggregationFeature` | The column's value in the totals row (aggregation feature): `'sum' \| 'avg' \| 'min' \| 'max'` over the cell values (empty values skipped), `'count'` of rows, or a function of the values and the rows. Shown with the column's renderer (`count` as a plain number). |
528
+ | `groupable` | `boolean` | `rowGroupingFeature` | The header menu offers Group by / Ungroup for this column (row grouping feature). Any column can be grouped through `v-model:group-by`; this only adds the menu items. |
529
+ | `groupValue` | `(row: T) => unknown` | `rowGroupingFeature` | The value rows are grouped by (row grouping feature), e.g. `(row) => row.placedAt.slice(0, 7)` for months. Default: the cell value, shown with the column's renderer; a `groupValue` is shown as text (or with the `#group-<key>` slot). |
530
+ | `exportValue` | `(row: T) => unknown` | `exportFeature` | The value exports and copying use (export feature), e.g. a plain id for a link or an object. Wins over the cell value and the renderer's text. |
531
+ | `exportable` | `boolean` | `exportFeature` | Included in CSV exports and copied rows (export feature)? Default `true`; set `false` on action columns. |
532
+ | `cellClass` | `ClassValue \| ((row: T) => ClassValue)` | | Extra classes for the column's body cells (or a function of the row). |
533
+ | `headerClass` | `ClassValue` | | Extra classes for the column's header cell. |
534
+
535
+ ## Renderers
536
+
537
+ Set `renderer` to the definition (`renderer: currencyRenderer`, tree-shakeable) or to a name registered with `createVueGrid({ renderers })` / `:renderers`; `rendererOptions` are typed against it. Option values marked `RowFn` / `RowOption` may also be `(value, row) => …`.
538
+
539
+ ### `text` — `textRenderer`
540
+
541
+ Text, the default renderer (the only one `<VGrid>` bundles): ellipsis, line clamp, tone, badge, icon, secondary text, copy button. Align: `start` · filter type: `text`.
542
+
543
+ | Option | Type | Description |
544
+ |---|---|---|
545
+ | `ellipsis` | `boolean` | Single line with ellipsis (full text in a tooltip). |
546
+ | `lines` | `number` | Clamp to N lines. |
547
+ | `maxWidth` | `string` | |
548
+ | `preserveNewlines` | `boolean` | Keep line breaks in the value (`white-space: pre-line`). |
549
+ | `tooltip` | `boolean \| RowFn<string \| undefined>` | `true` = value as tooltip; a function computes it. |
550
+ | `placeholder` | `string` | Shown when the value is empty. |
551
+ | `tone` | `RowOption<Tone \| undefined>` | |
552
+ | `toneMode` | `'text' \| 'fill'` | `text` (default) colours the text; `fill` colours the badge-like background. |
553
+ | `bold` | `RowOption<boolean>` | |
554
+ | `secondary` | `RowFn<string \| null \| undefined>` | Muted text after the value, e.g. a half-time score: `2:1 (1:0)`. |
555
+ | `badge` | `RowFn<BadgeSpec \| string \| null \| undefined>` | Badge before (default) or after the value. |
556
+ | `badgePosition` | `'start' \| 'end'` | |
557
+ | `icon` | `RowFn<IconSpec \| null \| undefined>` | Icon before the value, e.g. `{ icon: BellIcon, tone: 'warning', label: 'Notify' }`. |
558
+ | `copyable` | `boolean` | Adds a copy-to-clipboard button; emits `copy` with the copied text. |
559
+ | `copyValue` | `RowFn<string>` | What gets copied (default: the displayed text). |
560
+
561
+ ### `toggle-text` — `toggleTextRenderer`
562
+
563
+ Text that toggles a highlight when clicked. Emits `toggle` (with `clickable`). Align: `start` · filter type: `text`.
564
+
565
+ | Option | Type | Description |
566
+ |---|---|---|
567
+ | `clickable` | `boolean \| RowFn<boolean>` | When true, the text is a button that emits action `toggle`. |
568
+ | `highlighted` | `boolean \| RowFn<boolean>` | |
569
+ | `placeholder` | `string` | Shown when the value is empty. |
570
+
571
+ ### `number` — `numberRenderer`
572
+
573
+ Locale-formatted numbers. With `clickable`, a link-style button that emits `click`. Align: `end` · filter type: `number`.
574
+
575
+ | Option | Type | Description |
576
+ |---|---|---|
577
+ | `format` | `Intl.NumberFormatOptions` | `Intl.NumberFormat` options, e.g. `{ maximumFractionDigits: 0 }` or `{ style: 'percent' }`. |
578
+ | `placeholder` | `string` | Shown when the value is empty. |
579
+ | `clickable` | `RowOption<boolean>` | Renders the number as a link-style button that emits `click` (drill-down). |
580
+
581
+ ### `signed-number` — `signedNumberRenderer`
582
+
583
+ Numbers that always show their sign (+ / −). With `clickable`, emits `click`. Align: `end` · filter type: `number` · defaults: `{ signed: true }`.
584
+
585
+ | Option | Type | Description |
586
+ |---|---|---|
587
+ | `format` | `Intl.NumberFormatOptions` | `Intl.NumberFormat` options, e.g. `{ maximumFractionDigits: 0 }` or `{ style: 'percent' }`. |
588
+ | `placeholder` | `string` | Shown when the value is empty. |
589
+ | `clickable` | `RowOption<boolean>` | Renders the number as a link-style button that emits `click` (drill-down). |
590
+ | `signed` | `boolean` | |
591
+
592
+ ### `currency` — `currencyRenderer`
593
+
594
+ Money in a fixed or per-row currency (default: the grid's `currency`). With `clickable`, emits `click`. Align: `end` · filter type: `number`.
595
+
596
+ | Option | Type | Description |
597
+ |---|---|---|
598
+ | `currency` | `string \| RowFn<string \| undefined>` | ISO 4217 code, or derived from the row. Defaults to the grid context currency. |
599
+ | `format` | `Intl.NumberFormatOptions` | `Intl.NumberFormat` options, e.g. `{ maximumFractionDigits: 0 }` or `{ style: 'percent' }`. |
600
+ | `placeholder` | `string` | Shown when the value is empty. |
601
+ | `clickable` | `RowOption<boolean>` | Renders the number as a link-style button that emits `click` (drill-down). |
602
+
603
+ ### `change` — `changeRenderer`
604
+
605
+ A rise or fall: the value with an up / down arrow, green or red. Align: `end` · filter type: `number`.
606
+
607
+ | Option | Type | Description |
608
+ |---|---|---|
609
+ | `direction` | `RowFn<'up' \| 'down' \| 'equal' \| undefined>` | Defaults to the sign of a numeric value, or `true` / `false` (also as strings) → up / down. |
610
+ | `currency` | `boolean \| string` | Format as currency (`true` = context currency). |
611
+ | `iconOnly` | `boolean` | Only the arrow (the value becomes its accessible label). |
612
+ | `format` | `Intl.NumberFormatOptions` | `Intl.NumberFormat` options, e.g. `{ maximumFractionDigits: 0 }` or `{ style: 'percent' }`. |
613
+ | `placeholder` | `string` | Shown when the value is empty. |
614
+ | `clickable` | `RowOption<boolean>` | Renders the number as a link-style button that emits `click` (drill-down). |
615
+
616
+ ### `date` — `dateRenderer`
617
+
618
+ A calendar day, in the grid's locale and time zone (date-only strings never shift a day). Align: `start` · filter type: `date`.
619
+
620
+ | Option | Type | Description |
621
+ |---|---|---|
622
+ | `format` | `Intl.DateTimeFormatOptions` | `Intl.DateTimeFormat` options, e.g. `{ dateStyle: 'medium' }`. |
623
+ | `placeholder` | `string` | Shown when the value is empty. |
624
+
625
+ ### `datetime` — `dateTimeRenderer`
626
+
627
+ Date and time, on two lines by default. Align: `start` · filter type: `date`.
628
+
629
+ | Option | Type | Description |
630
+ |---|---|---|
631
+ | `milliseconds` | `boolean` | |
632
+ | `twoLines` | `boolean` | Date and time on two lines (default true). |
633
+ | `format` | `Intl.DateTimeFormatOptions` | `Intl.DateTimeFormat` options, e.g. `{ dateStyle: 'medium' }`. |
634
+ | `placeholder` | `string` | Shown when the value is empty. |
635
+
636
+ ### `boolean` — `booleanRenderer`
637
+
638
+ Yes / no as text labels or icons. Align: `start` · filter type: `boolean`.
639
+
640
+ | Option | Type | Description |
641
+ |---|---|---|
642
+ | `trueLabel` | `string` | |
643
+ | `falseLabel` | `string` | |
644
+ | `nullLabel` | `string` | |
645
+ | `display` | `'text' \| 'icon'` | `text` (default): labels. `icon`: a check for true, nothing (or a cross) for false. |
646
+ | `falseIcon` | `boolean` | In icon mode, show a cross for false (default: nothing). |
647
+
648
+ ### `status` — `statusRenderer`
649
+
650
+ A coloured status badge (tone from a map, a function or a constant). With `clickable`, emits `click`. Align: `start` · filter type: `set`.
651
+
652
+ | Option | Type | Description |
653
+ |---|---|---|
654
+ | `tone` | `ToneOption` | |
655
+ | `label` | `RowFn<string> \| Record<string, string>` | Label from a function, or a value → label map. |
656
+ | `dot` | `boolean` | |
657
+ | `variant` | `'soft' \| 'solid' \| 'outline'` | `soft` (default, tinted), `solid` (filled) or `outline`. |
658
+ | `placeholder` | `string` | Shown when the value is empty. |
659
+ | `clickable` | `RowOption<boolean>` | Badge becomes a button that emits `click`. |
660
+
661
+ ### `link` — `linkRenderer`
662
+
663
+ A safe link (http(s), mailto, tel only), or a `<RouterLink>` with `to` when vue-router is installed. Align: `start` · filter type: `text`.
664
+
665
+ | Option | Type | Description |
666
+ |---|---|---|
667
+ | `href` | `RowFn<string \| undefined>` | |
668
+ | `to` | `RowFn<RouteTarget \| null \| undefined>` | Router location; rendered with `<RouterLink>` when vue-router is installed, else as an href. |
669
+ | `label` | `RowFn<string>` | |
670
+ | `target` | `'_self' \| '_blank'` | |
671
+ | `tooltip` | `RowFn<string \| undefined>` | |
672
+
673
+ ### `icon` — `iconRenderer`
674
+
675
+ An icon component, fixed or picked per row. Align: `center` · filter type: `text`.
676
+
677
+ | Option | Type | Description |
678
+ |---|---|---|
679
+ | `icon` | `Component` | Static icon component. |
680
+ | `iconFor` | `RowFn<Component \| undefined>` | Picks the icon per row (wins over `icon`). Kept separate because functional components are functions too. |
681
+ | `show` | `RowFn<boolean>` | |
682
+ | `label` | `string \| RowFn<string>` | |
683
+ | `tone` | `Tone \| RowFn<Tone \| undefined>` | |
684
+
685
+ ### `json` — `jsonRenderer`
686
+
687
+ A button that opens the value as escaped JSON in a dialog. Align: `start` · filter type: `text`.
688
+
689
+ | Option | Type | Description |
690
+ |---|---|---|
691
+ | `label` | `string` | |
692
+ | `dialogTitle` | `string \| RowFn<string>` | |
693
+
694
+ ### `json-tree` — `jsonTreeRenderer`
695
+
696
+ A collapsible tree of nested data. Align: `start` · filter type: `text`.
697
+
698
+ | Option | Type | Description |
699
+ |---|---|---|
700
+ | `collapseAt` | `number` | Nodes deeper than this start collapsed. Default 1. |
701
+ | `maxDepth` | `number` | Deeper nodes are summarised (“3 items”) instead of expanded. Default unlimited. |
702
+ | `parseNested` | `boolean` | String values that contain JSON are shown as nested trees. |
703
+ | `collapsed` | `boolean` | Starts hidden behind a toggle button (labelled `toggleLabel`, default “More info”). |
704
+ | `toggleLabel` | `string` | |
705
+ | `emptyText` | `string` | Shown for null / empty values. Default: nothing. |
706
+
707
+ ### `actions-menu` — `actionsMenuRenderer`
708
+
709
+ A `⋯` button with a keyboard-friendly menu. Emits the chosen item's `name`. Align: `center` · filter type: `text`.
710
+
711
+ | Option | Type | Description |
712
+ |---|---|---|
713
+ | `actions` | `MenuItem[] \| ((row: any) => MenuItem[])` | Menu items (actions and `{ separator: true }`), or a function of the row. |
714
+ | `label` | `string` | |
715
+
716
+ ### `action-button` — `actionButtonRenderer`
717
+
718
+ One button per row. Emits its `action` (default `click`). Align: `start` · filter type: `text`.
719
+
720
+ | Option | Type | Description |
721
+ |---|---|---|
722
+ | `label` | `string \| RowFn<string>` | |
723
+ | `action` | `string` | Action name emitted on click. Default `click`. |
724
+ | `icon` | `Component` | |
725
+ | `tone` | `Tone` | |
726
+ | `disabled` | `RowFn<boolean>` | |
727
+ | `visible` | `RowFn<boolean>` | Hide the button for some rows. |
728
+ | `variant` | `ButtonVariant` | |
729
+ | `iconOnly` | `boolean` | Only the icon; the label becomes its accessible name and tooltip. |
730
+
731
+ ### `multi-line` — `multiLineRenderer`
732
+
733
+ Stacked lines, each with its own style, link, badge, trend or action. Align: `start` · filter type: `text`.
734
+
735
+ | Option | Type | Description |
736
+ |---|---|---|
737
+ | `lines` | `RowFn<LineInput[] \| null \| undefined>` | Builds the lines; default: the value itself when it's an array. |
738
+ | `boldLines` | `number[]` | Indexes of lines to show in bold. |
739
+ | `ellipsis` | `boolean` | Each line on one row with ellipsis (default true). |
740
+ | `target` | `'_self' \| '_blank'` | |
741
+ | `placeholder` | `string` | Shown when the value is empty. |
742
+
743
+ ### `copy` — `copyRenderer`
744
+
745
+ A value with a copy-to-clipboard button. Emits `copy` / `copy-error`. Align: `start` · filter type: `text`.
746
+
747
+ | Option | Type | Description |
748
+ |---|---|---|
749
+ | `copyValue` | `RowFn<string>` | What gets copied (default: the displayed text). |
750
+ | `iconOnly` | `boolean` | Only the copy button; the value becomes its tooltip. |
751
+ | `label` | `string` | Accessible name of the button. Default “Copy”. |
752
+ | `title` | `string` | Shown before the value in the tooltip, e.g. “Serial number”. |
753
+ | `placeholder` | `string` | Shown when the value is empty. |
754
+
755
+ ### `chip` — `chipRenderer`
756
+
757
+ A chip in any colour (readable text picked by contrast), square, circle or pill. Align: `start` · filter type: `set`.
758
+
759
+ | Option | Type | Description |
760
+ |---|---|---|
761
+ | `color` | `RowOption<string \| null \| undefined>` | Any CSS colour (e.g. from an API); text colour is picked for contrast. |
762
+ | `tone` | `ToneOption` | Named tone instead of a raw colour. |
763
+ | `label` | `RowFn<string>` | |
764
+ | `tooltip` | `RowFn<string \| null \| undefined>` | |
765
+ | `shape` | `'square' \| 'circle' \| 'pill'` | |
766
+ | `size` | `string` | Box size for square/circle. Default `1.75rem`. |
767
+ | `placeholder` | `string` | Shown when the value is empty. |
768
+
769
+ ### `checkbox` — `checkboxRenderer`
770
+
771
+ A controlled checkbox, with a tooltip when disabled. Emits `change` with the requested state. Align: `center` · filter type: `boolean`.
772
+
773
+ | Option | Type | Description |
774
+ |---|---|---|
775
+ | `checked` | `RowFn<boolean>` | Default: the value is truthy. |
776
+ | `disabled` | `RowOption<boolean>` | |
777
+ | `disabledReason` | `RowFn<string \| null \| undefined>` | Tooltip explaining why it's disabled. |
778
+ | `label` | `RowOption<string>` | Accessible name. Default: the column header. |
779
+
780
+ ### `switch` — `switchRenderer`
781
+
782
+ A controlled on / off switch. Emits `change` with the requested state. Align: `center` · filter type: `boolean`.
783
+
784
+ | Option | Type | Description |
785
+ |---|---|---|
786
+ | `checked` | `RowFn<boolean>` | Default: the value is truthy. |
787
+ | `disabled` | `RowOption<boolean>` | |
788
+ | `disabledReason` | `RowFn<string \| null \| undefined>` | Tooltip explaining why it's disabled. |
789
+ | `label` | `RowOption<string>` | Accessible name. Default: the column header. |
790
+
791
+ ### `radio` — `radioRenderer`
792
+
793
+ One selected row across the column (controlled). Emits `select`. Align: `center` · filter type: `boolean`.
794
+
795
+ | Option | Type | Description |
796
+ |---|---|---|
797
+ | `name` | `string` | Radio group name. Default: the column key. |
798
+ | `checked` | `RowFn<boolean>` | Default: the value is truthy. |
799
+ | `disabled` | `RowOption<boolean>` | |
800
+ | `disabledReason` | `RowFn<string \| null \| undefined>` | Tooltip explaining why it's disabled. |
801
+ | `label` | `RowOption<string>` | Accessible name. Default: the column header. |
802
+
803
+ ### `edit` — `editRenderer`
804
+
805
+ A value with an edit button, for opening your own editor. Emits `edit`. Align: `start` · filter type: `text`.
806
+
807
+ | Option | Type | Description |
808
+ |---|---|---|
809
+ | `format` | `RowFn<string>` | Text shown next to the edit button (default: the value). |
810
+ | `placeholder` | `string` | Shown when the value is empty. |
811
+ | `label` | `string` | Accessible name of the button. Default “Edit”. |
812
+ | `disabled` | `RowOption<boolean>` | |
813
+ | `bold` | `boolean` | |
814
+
815
+ ### `image` — `imageRenderer`
816
+
817
+ A thumbnail, with a placeholder when empty or broken. Align: `center` · filter type: `text`.
818
+
819
+ | Option | Type | Description |
820
+ |---|---|---|
821
+ | `src` | `RowFn<string \| null \| undefined>` | Default: the value. |
822
+ | `baseUrl` | `string` | Prefixed to relative paths (e.g. a CDN). |
823
+ | `alt` | `RowOption<string>` | |
824
+ | `size` | `string` | Default `2.5rem`. |
825
+ | `fit` | `'contain' \| 'cover'` | |
826
+ | `shape` | `'rounded' \| 'circle' \| 'square'` | |
827
+
828
+ ### `code` — `codeRenderer`
829
+
830
+ Monospaced code, with JSON pretty-printing and highlighting. Align: `start` · filter type: `text`.
831
+
832
+ | Option | Type | Description |
833
+ |---|---|---|
834
+ | `language` | `'auto' \| 'json' \| 'text'` | `auto` (default): JSON for objects and JSON strings, plain text otherwise. |
835
+ | `lines` | `number` | Clamp to N lines (full text in a tooltip). |
836
+ | `indent` | `number` | JSON indent. Default 2. |
837
+ | `highlight` | `boolean` | Colour JSON tokens. Default true. |
838
+
839
+ ### `button-group` — `buttonGroupRenderer`
840
+
841
+ Several buttons, fixed or per row. Emits the clicked button's `name`. Align: `start` · filter type: `text`.
842
+
843
+ | Option | Type | Description |
844
+ |---|---|---|
845
+ | `buttons` | `ButtonSpec[] \| ((row: any) => ButtonSpec[])` | |
846
+
847
+ ### `icon-toggle` — `iconToggleRenderer`
848
+
849
+ A star / flag style on-off button (controlled). Emits `toggle`. Align: `center` · filter type: `boolean`.
850
+
851
+ | Option | Type | Description |
852
+ |---|---|---|
853
+ | `active` | `RowFn<boolean>` | Default: the value is truthy. |
854
+ | `icon` | `Component` | Default: an outlined star. |
855
+ | `activeIcon` | `Component` | Default: a filled star (or `icon`). |
856
+ | `label` | `RowOption<string>` | Accessible name. Default “Toggle”. |
857
+ | `activeTone` | `Tone` | Tone when active. Default `warning`. |
858
+ | `disabled` | `RowOption<boolean>` | |
859
+
860
+ ### `details` — `detailsRenderer`
861
+
862
+ A status badge plus an info button with an anchored popover of label / value rows. Align: `start` · filter type: `text`.
863
+
864
+ | Option | Type | Description |
865
+ |---|---|---|
866
+ | `tone` | `ToneOption` | Summary badge tone, like `status`. |
867
+ | `label` | `RowFn<string>` | |
868
+ | `items` | `RowFn<DetailItem[] \| null \| undefined>` | Popover rows. Empty → no info button. |
869
+ | `title` | `RowOption<string>` | Popover heading. Default: the column header. |
870
+ | `triggerLabel` | `string` | Accessible name of the info button. Default “Details”. |
871
+
872
+ ### `list` — `listRenderer`
873
+
874
+ The first items of a list, with a “+N more” toggle. Emits `expand`. Align: `start` · filter type: `text`.
875
+
876
+ | Option | Type | Description |
877
+ |---|---|---|
878
+ | `items` | `RowFn<unknown[] \| null \| undefined>` | Default: the value when it's an array. |
879
+ | `itemLabel` | `RowFn<string>` | |
880
+ | `max` | `number` | Items shown before “+N more”. Default 1. |
881
+ | `placeholder` | `string` | Shown when the value is empty. |
882
+
883
+ ## Types
884
+
885
+ ### `VirtualOptions`
886
+
887
+ | Field | Type | Description |
888
+ |---|---|---|
889
+ | `rowHeight` | `number` | Fixed row height in px. |
890
+ | `overscan`? | `number` | Extra rows rendered above/below the viewport. Default 6. |
891
+ | `detailHeight`? | `number` | Estimated height in px of a detail row (`#detail` slot) until it has been rendered and measured. Default 4 × `rowHeight`. Data rows always have `rowHeight`. |
892
+
893
+ ### `PinnedRowsState`
894
+
895
+ | Field | Type | Description |
896
+ |---|---|---|
897
+ | `top`? | `RowKey[]` | |
898
+ | `bottom`? | `RowKey[]` | |
899
+
900
+ ### `ColumnState`
901
+
902
+ | Field | Type | Description |
903
+ |---|---|---|
904
+ | `order` | `string[]` | Column keys in display order (all known columns, visible or not). |
905
+ | `hidden` | `string[]` | Keys of hidden columns. |
906
+ | `pinned`? | `Record<string, PinSide \| null>` | Runtime pin overrides (e.g. from the header menu). `null` = explicitly unpinned; a missing key falls back to the column's `pinned` definition. Optional so older persisted state still loads. |
907
+ | `widths`? | `Record<string, string>` | Widths the user resized columns to (CSS lengths, e.g. `'240px'`). Column resizing feature. |
908
+
909
+ ### `SortState`
910
+
911
+ | Field | Type | Description |
912
+ |---|---|---|
913
+ | `key` | `string` | |
914
+ | `dir` | `SortDir` | |
915
+
916
+ ### `ColumnFilterOptions`
917
+
918
+ | Field | Type | Description |
919
+ |---|---|---|
920
+ | `type`? | `FilterType` | |
921
+ | `options`? | `readonly FilterOption[] \| FilterOptionsLoader` | Choices for a `set` filter: a list, or a loader called with the search text (e.g. from a backend — honour `signal`). Default: distinct values from the rows. |
922
+ | `placeholder`? | `string` | Placeholder of the filter-row input. |
923
+
924
+ ### `FilterOption`
925
+
926
+ | Field | Type | Description |
927
+ |---|---|---|
928
+ | `value` | `unknown` | |
929
+ | `label`? | `string` | |
930
+ | `count`? | `number` | Shown next to the option (e.g. number of rows). |
931
+
932
+ ### `MenuAction`
933
+
934
+ | Field | Type | Description |
935
+ |---|---|---|
936
+ | `name` | `string` | Emitted as the action name. |
937
+ | `label` | `string` | |
938
+ | `disabled`? | `boolean` | |
939
+ | `tone`? | `MenuTone` | |
940
+ | `icon`? | `Component` | |
941
+ | `hint`? | `string` | Shown right-aligned, e.g. a shortcut hint. |
942
+
943
+ ### `CellContext`
944
+
945
+ | Field | Type | Description |
946
+ |---|---|---|
947
+ | `row` | `T` | |
948
+ | `rowKey` | `RowKey` | |
949
+ | `column` | `ColumnDef<T>` | |
950
+ | `value` | `unknown` | |
951
+
952
+ ### `CellActionEvent`
953
+
954
+ | Field | Type | Description |
955
+ |---|---|---|
956
+ | `name` | `string` | |
957
+ | `payload` | `unknown` | |
958
+ | `row` | `T` | |
959
+ | `rowKey` | `RowKey` | |
960
+ | `column` | `ColumnDef<T>` | |
961
+
962
+ ### `CellClickEvent`
963
+
964
+ | Field | Type | Description |
965
+ |---|---|---|
966
+ | `row` | `T` | |
967
+ | `rowKey` | `RowKey` | |
968
+ | `column` | `ColumnDef<T>` | |
969
+ | `value` | `unknown` | |
970
+ | `event` | `MouseEvent \| KeyboardEvent` | |
971
+
972
+ ### `ContextActionEvent`
973
+
974
+ | Field | Type | Description |
975
+ |---|---|---|
976
+ | `name` | `string` | |
977
+ | `item` | `MenuAction` | |
978
+ | `row` | `T` | |
979
+ | `rowKey` | `RowKey` | |
980
+ | `column` | `ColumnDef<T>` | |
981
+ | `value` | `unknown` | |
982
+
983
+ ### `HeaderActionEvent`
984
+
985
+ | Field | Type | Description |
986
+ |---|---|---|
987
+ | `name` | `string` | |
988
+ | `item` | `MenuAction` | |
989
+ | `column` | `ColumnDef<T>` | |
990
+
991
+ ### `VueGridConfig`
992
+
993
+ | Field | Type | Description |
994
+ |---|---|---|
995
+ | `renderers`? | `CellRendererDefinition[]` | |
996
+ | `features`? | `readonly GridFeature[]` | Features every grid in the app gets (`allFeatures` for all of them). |
997
+ | `locale`? | `string` | |
998
+ | `currency`? | `string` | |
999
+ | `timeZone`? | `string` | |
1000
+ | `density`? | `Density` | |
1001
+
1002
+ ---
1003
+
1004
+ # README
1005
+
1006
+ # @nocopypaste/vue-grid
1007
+
1008
+ A data grid for Vue 3 built on **CSS Grid** — with real `subgrid` sub-rows, pinned columns, column
1009
+ reorder/visibility with persistence, selection, virtual scrolling, pagination, a pluggable
1010
+ **cell-renderer registry** for 3rd-party addons, and a theme you customise with **CSS variables**.
1011
+
1012
+ - Vue `^3.5` peer dependency, zero runtime dependencies, fully typed (`<VGrid generic="T">`).
1013
+ - Plain CSS in `@layer vue-grid` — your CSS / Tailwind utilities override it without `!important`.
1014
+ Published minified (Lightning CSS, no transpiling).
1015
+ - Built for big data: virtual scrolling with sub-grids and detail rows, cell-level partial updates,
1016
+ a GPU-animated change highlight — see [Performance](#performance).
1017
+ - Safe with untrusted row data: no `v-html` / `innerHTML` anywhere. Link renderers allow only
1018
+ http(s), mailto and tel, and URLs are checked after the cleanup browsers apply (so `java\tscript:`
1019
+ is caught). Value maps ignore inherited keys, and saved state is validated.
1020
+
1021
+ **New here? Start with the [examples cookbook](../../docs/examples.md)** — runnable snippets for every
1022
+ feature. This README is the API reference.
1023
+
1024
+ ## Install
1025
+
1026
+ ```sh
1027
+ npm i @nocopypaste/vue-grid
1028
+ ```
1029
+
1030
+ The package is built for a bundler (Vite, webpack, Rollup, esbuild, or a framework built on one),
1031
+ like Vue's own `esm-bundler` build. Dev-only warnings are wrapped in
1032
+ `process.env.NODE_ENV !== 'production'`, which the bundler replaces, so they disappear from
1033
+ production builds. Loading the files straight in a browser (an import map or CDN `<script>`, no
1034
+ build step) throws `process is not defined`. If you must do that, define it first:
1035
+ `<script>window.process = { env: { NODE_ENV: 'production' } }</script>`.
1036
+
1037
+ ```ts
1038
+ // main.ts
1039
+ import { createApp } from 'vue'
1040
+ import { createVueGrid } from '@nocopypaste/vue-grid'
1041
+ import '@nocopypaste/vue-grid/style.css'
1042
+
1043
+ createApp(App)
1044
+ .use(createVueGrid({ locale: 'en-US', currency: 'EUR' })) // optional: app-wide defaults
1045
+ .mount('#app')
1046
+ ```
1047
+
1048
+ ## Quick start
1049
+
1050
+ ```vue
1051
+ <script setup lang="ts">
1052
+ import { ref } from 'vue'
1053
+ import {
1054
+ VGrid,
1055
+ createColumnHelper,
1056
+ currencyRenderer,
1057
+ dateTimeRenderer,
1058
+ numberRenderer,
1059
+ columnPinningFeature,
1060
+ sortingFeature,
1061
+ statusRenderer,
1062
+ type SortState,
1063
+ } from '@nocopypaste/vue-grid'
1064
+
1065
+ interface Order { id: number; customer: { name: string }; total: number; status: 'Paid' | 'Open'; placedAt: string }
1066
+
1067
+ const rows = ref<Order[]>([/* … */])
1068
+ const sort = ref<SortState | null>(null)
1069
+
1070
+ const col = createColumnHelper<Order>()
1071
+ const columns = [
1072
+ col({ key: 'id', header: '#', renderer: numberRenderer, width: 'min-content', pinned: 'left' }),
1073
+ col({ key: 'customer', header: 'Customer', field: 'customer.name', sortable: true, width: 'minmax(10rem, 1fr)' }),
1074
+ col({ key: 'total', header: 'Total', renderer: currencyRenderer, sortable: true }),
1075
+ col({ key: 'status', header: 'Status', renderer: statusRenderer, rendererOptions: { tone: { Paid: 'success', Open: 'info' } } }),
1076
+ col({ key: 'placedAt', header: 'Placed', renderer: dateTimeRenderer }),
1077
+ ]
1078
+ </script>
1079
+
1080
+ <template>
1081
+ <VGrid
1082
+ v-model:sort="sort"
1083
+ :rows="rows"
1084
+ :columns="columns"
1085
+ row-key="id"
1086
+ :features="[sortingFeature, columnPinningFeature]"
1087
+ sort-mode="client"
1088
+ style="height: 480px"
1089
+ />
1090
+ </template>
1091
+ ```
1092
+
1093
+ `createColumnHelper<T>()` is optional; it types each column's `rendererOptions` from its renderer.
1094
+
1095
+ ## Features: everything optional
1096
+
1097
+ Out of the box `<VGrid>` is a plain, read-only table: columns with any renderer and any width,
1098
+ saved column state (`storage`), detail rows, tabbable controls and theming. Everything else is
1099
+ an opt-in feature:
1100
+
1101
+ | Feature | Turns on |
1102
+ |---|---|
1103
+ | `sortingFeature` | Sort buttons on `sortable` headers, the header menu's sort items, `sort-mode="client"` sorting |
1104
+ | `filteringFeature` | Funnels on `filterable` headers, `filter-row`, `<VGridSearch>`, `v-model:filters`, `filter-storage`, the header menu's filter items |
1105
+ | `serverDataFeature` | `data-source`: the grid fetches sorted, filtered pages itself |
1106
+ | `paginationFeature` | `pagination` and `v-model:page` / `v-model:page-size` (the standalone `<VGridPagination>` doesn't need it) |
1107
+ | `selectionFeature` | `selectable` (multi or single), `v-model:selected`, `selection-mode`, `is-row-selectable`, select-all, Space to select, shift-click / Shift+Space ranges, `prune-selection`, the selection in `#toolbar` for batch actions, "select all N matching rows" with server data (`v-model:select-all-matching`) |
1108
+ | `subGridsFeature` | `sub-rows` / `load-sub-rows` / `has-sub-rows`: nested rows in a CSS `subgrid` (detail rows don't need it) |
1109
+ | `menusFeature` | The header right-click menu (`header-menu`) and body-cell menus (`context-menu`); without it the browser's menu shows. The standalone `<VGridMenu>` and the `actions-menu` renderer don't need it |
1110
+ | `columnReorderFeature` | Dragging headers to reorder (mouse and pen; on touch, hold the header first), Alt+←/→ on a header, the header menu's Move items |
1111
+ | `columnPinningFeature` | Sticky `pinned: 'left' \| 'right'` columns with edge shadows, the header menu's Pin items; without it pins are ignored |
1112
+ | `virtualScrollingFeature` | `virtual: { rowHeight, overscan?, detailHeight? }`: only the rows in view render, sub-grids and detail rows included; without it every row renders |
1113
+ | `columnVisibilityFeature` | `hidden: true` columns, `columnState.hidden`, the header menu's Hide column item; without it every column shows |
1114
+ | `keyboardNavigationFeature` | The ARIA grid pattern: one Tab stop, arrow keys / Home / End / PageUp / PageDown between cells, Enter, Space to select, →/← to expand, Alt+←/→ to move a column. Without it the grid is an ARIA `table` with its controls in the Tab order |
1115
+ | `columnResizingFeature` | Drag a header edge to resize (mouse, pen, touch), double-click it to fit the content, ←/→ on the focused edge (Alt+Shift+←/→ on a header with keyboard navigation); `minWidth` / `maxWidth` bound it, `resizable: false` opts out; widths in `columnState.widths`, persisted with `storage`; Fit width / Reset width in the header menu |
1116
+ | `columnGroupsFeature` | Grouped column headers: columns with the same `group` share a header cell in a sticky row above theirs; groups follow reordering, hiding, resizing and pinning (a pin boundary splits a group) |
1117
+ | `rowPinningFeature` | `v-model:pinned-rows` / `pinRow()`: rows that stay in view above or below the body, plus `pinned-top-rows` / `pinned-bottom-rows` for rows that aren't in the data |
1118
+ | `aggregationFeature` | Column `aggregate` (`sum`, `avg`, `min`, `max`, `count`, a function) and `totals`: a sticky totals row over the filtered rows |
1119
+ | `rowGroupingFeature` | `v-model:group-by`: rows grouped by one or more columns into collapsible group rows with the value, row count and aggregates; Group by / Ungroup in the header menu for `groupable` columns |
1120
+ | `exportFeature` | `exportCsv()` / `getCsv()` / `copyRows()`, Ctrl/⌘+C for the selected rows or the focused cell, the `copy` event; column `exportValue` / `exportable` |
1121
+
1122
+ ```ts
1123
+ // per grid
1124
+ <VGrid :features="[sortingFeature, filteringFeature]" … />
1125
+
1126
+ // or for every grid in the app (merged with each grid's own list)
1127
+ app.use(createVueGrid({ features: [sortingFeature, filteringFeature] }))
1128
+ app.use(createVueGrid({ features: allFeatures })) // all of them
1129
+ ```
1130
+
1131
+ Only the features you import reach your bundle. Without its feature, an option does nothing:
1132
+ a `sortable` column is a plain header and `data-source` is never called. In development a warning
1133
+ names the feature to add. A grid reads `features` once, when it is created; to change them,
1134
+ re-create it (for example with a `:key`).
1135
+
1136
+ ## Tree-shaking: import only what you use
1137
+
1138
+ The package is ESM, one file per module, with `sideEffects` limited to CSS — bundlers keep only
1139
+ what you import.
1140
+
1141
+ - **Features are opt-in** (see above).
1142
+ - **Renderers are opt-in.** `<VGrid>` bundles just the default `text` renderer. Use others either
1143
+ - **per column** (recommended, smallest bundle, typed options): `renderer: currencyRenderer`, or
1144
+ - **by name**, after registering them: `createVueGrid({ renderers: [currencyRenderer, statusRenderer] })`
1145
+ or `<VGrid :renderers="[…]">`, then `renderer: 'currency'`. `allRenderers` registers every built-in.
1146
+ An unregistered name renders as plain text and logs a dev warning saying how to register it.
1147
+ - **Components and helpers** (`VGridPagination`, `VGridColumnMenu`, `VGridMenu`, `sortRows`, …) are
1148
+ only bundled when imported.
1149
+ - **CSS**: `@nocopypaste/vue-grid/style.css` has everything. Pick parts instead:
1150
+
1151
+ | File | What | gzip |
1152
+ |---|---|---|
1153
+ | `base.css` | Structure only: grid layout, subgrid, sticky header and pins, tree indent, popover placement, virtual rows, pinned rows, truncation | 2.2 kB |
1154
+ | `theme.css` | The default look on top of `base.css`: `--vg-*` tokens, colours, dark mode, densities, spacing, borders, typography, shadows, animation | 3.3 kB |
1155
+ | `core.css` | `base.css` + `theme.css` | 5.1 kB |
1156
+ | `renderers.css` | Styles for the cell renderers (other than text); uses the theme's tokens | 2.2 kB |
1157
+ | `style.css` | All of the above | 6.6 kB |
1158
+
1159
+ For a fully custom look, import only `base.css` (and `renderers.css` if you use renderers)
1160
+ and style the `.vg-*` classes yourself. See [Theming](#theming).
1161
+
1162
+ | Import (minified / gzip, Vue excluded) | Initial chunk |
1163
+ |---|---|
1164
+ | `VGrid` (no features) | 39.0 kB / 13.6 kB |
1165
+ | `VGrid` + `sortingFeature` | 39.8 kB / 13.9 kB |
1166
+ | `VGrid` + `filteringFeature` | 49.7 kB / 17.4 kB |
1167
+ | `VGrid` + `serverDataFeature` | 40.4 kB / 14.2 kB |
1168
+ | `VGrid` + `paginationFeature` | 39.2 kB / 13.7 kB |
1169
+ | `VGrid` + `selectionFeature` | 43.2 kB / 15.1 kB |
1170
+ | `VGrid` + `subGridsFeature` | 41.4 kB / 14.5 kB |
1171
+ | `VGrid` + `menusFeature` | 49.6 kB / 17.2 kB |
1172
+ | `VGrid` + `columnReorderFeature` | 42.7 kB / 14.9 kB |
1173
+ | `VGrid` + `columnPinningFeature` | 41.2 kB / 14.5 kB |
1174
+ | `VGrid` + `virtualScrollingFeature` | 44.8 kB / 15.8 kB |
1175
+ | `VGrid` + `columnVisibilityFeature` | 39.2 kB / 13.7 kB |
1176
+ | `VGrid` + `keyboardNavigationFeature` | 41.5 kB / 14.5 kB |
1177
+ | `VGrid` + `columnResizingFeature` | 41.8 kB / 14.7 kB |
1178
+ | `VGrid` + `columnGroupsFeature` | 40.3 kB / 14.1 kB |
1179
+ | `VGrid` + `rowPinningFeature` | 44.0 kB / 15.0 kB |
1180
+ | `VGrid` + `aggregationFeature` | 44.2 kB / 15.1 kB |
1181
+ | `VGrid` + `rowGroupingFeature` | 48.6 kB / 16.4 kB |
1182
+ | `VGrid` + `exportFeature` | 42.8 kB / 15.1 kB |
1183
+ | `VGrid` + `allFeatures` + `VGridSearch` | 102.8 kB / 34.7 kB |
1184
+ | `VGrid` + `currencyRenderer` | 40.4 kB / 14.1 kB |
1185
+ | `VGrid` + `VGridPagination` + `VGridColumnMenu` | 45.8 kB / 15.9 kB |
1186
+ | `sortRows` only | 0.7 kB / 0.4 kB |
1187
+ | `toCsv` only | 1.1 kB / 0.6 kB |
1188
+ | everything | 147.4 kB / 47.2 kB |
1189
+ | `validateGridConfig` (`@nocopypaste/vue-grid/agent`, never in an app bundle) | 63.7 kB / 17.1 kB |
1190
+
1191
+ With `filteringFeature`, the filter popover body and the filter-row editors are **on-demand
1192
+ chunks**: they load the first time a popover opens or `filter-row` is on. With
1193
+ `paginationFeature`, the pager is one too, and with `selectionFeature` the "select all N rows" banner.
1194
+
1195
+ Measured with Rolldown (the bundler in Vite) on tiny apps importing the published build:
1196
+ minified, gzipped, Vue external, `process.env.NODE_ENV` set to `production` (which also drops the
1197
+ dev warnings). "Initial" counts the entry and every chunk it loads up front; on-demand chunks are
1198
+ left out. esbuild with `--splitting` tree-shakes the package too, but also loads the pager's and
1199
+ the filter core's chunks (5.2 kB, 2.3 kB gzip) in a grid without those features: esbuild keeps
1200
+ chunks that on-demand imports share with the entry, even when nothing uses them.
1201
+
1202
+ ## `<VGrid>` API
1203
+
1204
+ ### Props
1205
+
1206
+ | Prop | Type | Default | |
1207
+ |---|---|---|---|
1208
+ | `rows` | `T[]` | `[]` | Your data objects, used as-is (never mutated). Not needed with `dataSource`. |
1209
+ | `features` | `GridFeature[]` | — | Opt-in features for this grid, added to the app-wide ones. See [Features](#features-everything-optional). |
1210
+ | `dataSource` | `(query, { signal }) => Promise<{ rows, total? }>` | — | Server rows: the grid calls it whenever sort, filters or page change. Needs `serverDataFeature`. See [Server data](#server-data). |
1211
+ | `columns` | `ColumnDef<T>[]` | — | See below. |
1212
+ | `rowKey` | `keyof T \| (row) => string \| number` | — | Stable unique id; all row state is keyed by it. |
1213
+ | `v-model:sort` | `{ key, dir: 'asc' \| 'desc' } \| null` | `null` | Header click cycles asc → desc → none. Needs `sortingFeature` for the header UI. |
1214
+ | `sortMode` | `'controlled' \| 'client'` | `'controlled'` | `controlled` only emits (server-side sorting). Ignored with `dataSource`. |
1215
+ | `v-model:filters` | `FilterState \| null` | `null` | `{ columns: Record<key, ColumnFilter>, search }`. Needs `filteringFeature` (as do the next four). See [Filtering](#filtering). |
1216
+ | `filterMode` | `'client' \| 'controlled'` | `'client'` | `controlled` only emits (server-side filtering). Ignored with `dataSource`. |
1217
+ | `filterRow` | `boolean` | `false` | A row of inline filter inputs under the headers. |
1218
+ | `filterStorage` | `string \| FilterStateStorage` | — | Persist filters (`string` = localStorage key). |
1219
+ | `noMatchText` | `string` | `'No rows match the current filters.'` | Shown, with a *Clear filters* button, when filters hide every row. |
1220
+ | `pagination` | `boolean \| { pageSizes?: number[] }` | `false` | Built-in pagination bar: slices client rows, or asks the `dataSource` for pages. Needs `paginationFeature`. |
1221
+ | `v-model:page` / `v-model:pageSize` | `number` | `1` / `25` | Reset to page 1 when sort or filters change. |
1222
+ | `v-model:columnState` | `{ order: string[]; hidden: string[]; pinned?: Record<string, "left" \| "right" \| null>; widths?: Record<string, string> }` | derived | Column order, visibility and runtime pins. |
1223
+ | `storage` | `string \| ColumnStateStorage` | — | Persist column state (`string` = localStorage key). |
1224
+ | `v-model:expanded` | `RowKey[]` | `[]` | Expanded rows (sub-grids and detail rows). |
1225
+ | `subRows` | `(row) => T[] \| undefined` | — | Synchronous children → sub-grid. Needs `subGridsFeature` (as do the next two). |
1226
+ | `loadSubRows` | `(row) => Promise<T[]>` | — | Lazy children (cached, loading/error/retry). |
1227
+ | `hasSubRows` | `(row) => boolean` | — | Which rows get an expander when lazy. |
1228
+ | `rowExpandable` | `(row) => boolean` | — | Which rows can open the `#detail` slot. |
1229
+ | `selectable` | `boolean \| 'single'` | `false` | Adds a selection column. Needs `selectionFeature` (as do the next five). See [Selection and batch actions](#selection-and-batch-actions). |
1230
+ | `v-model:selected` | `RowKey[]` | `[]` | |
1231
+ | `selectionMode` | `'cascade' \| 'independent'` | `'cascade'` | Whether selecting a parent selects its children. |
1232
+ | `isRowSelectable` | `(row) => boolean` | — | |
1233
+ | `pruneSelection` | `boolean` | `false` | Drop selected keys whose rows left the data (reload, delete, another server page). |
1234
+ | `v-model:selectAllMatching` | `boolean` | `false` | Server data: every row matching the query is selected (from the banner). |
1235
+ | `virtual` | `{ rowHeight: number; overscan?: number; detailHeight?: number } \| false` | `false` | Virtual scrolling (fixed-height rows; sub-grids and measured detail rows included). Needs `virtualScrollingFeature`. |
1236
+ | `v-model:pinnedRows` | `{ top?: RowKey[]; bottom?: RowKey[] } \| null` | `null` | Top-level rows pinned above / below the body. Needs `rowPinningFeature` (as do the next two). See [Pinned rows and totals](#pinned-rows-and-totals). |
1237
+ | `pinnedTopRows` / `pinnedBottomRows` | `T[]` | — | Extra pinned rows that aren't part of `rows` (a target, last year's figures). |
1238
+ | `totals` | `boolean \| 'top' \| 'bottom'` | `false` | A totals row with each column's `aggregate`; `true` = `'bottom'`. Needs `aggregationFeature` (as do the next two). |
1239
+ | `totalsLabel` | `string` | `'Total'` | Shown in the totals row's first column (unless that column has an aggregate). |
1240
+ | `aggregates` | `Record<string, unknown>` | — | Totals by column key, used instead of computing them (e.g. from a server). |
1241
+ | `v-model:groupBy` | `string[] \| string \| null` | `null` | Column keys to group the rows by, outermost first. Needs `rowGroupingFeature` (as does the next one). See [Row grouping](#row-grouping). |
1242
+ | `groupsExpanded` | `boolean` | `false` | Groups start expanded. |
1243
+ | `rowClickable` | `boolean` | `false` | Pointer cursor; `row-click` is always emitted. |
1244
+ | `rowClass` | `(row, index) => ClassValue` | — | |
1245
+ | `highlightedRows` | `RowKey[]` | — | |
1246
+ | `flash` | `boolean \| 'direction'` | `false` | Briefly highlight cells whose value changes; `'direction'` = green up / red down. Columns override with `flash`. |
1247
+ | `renderers` | `CellRendererDefinition[]` | — | Renderers usable by name in this grid (override plugin ones). |
1248
+ | `locale` / `currency` / `timeZone` | `string` | plugin → browser | Formatting context for renderers. |
1249
+ | `density` | `'compact' \| 'cozy' \| 'comfortable'` | `'cozy'` | Scales cell padding. |
1250
+ | `loading` | `boolean` | `false` | Progress bar + `aria-busy`. |
1251
+ | `emptyText` | `string` | `'No data to show.'` | |
1252
+ | `ariaLabel` | `string` | — | |
1253
+ | `contextMenu` | `(ctx: { row, rowKey, column, value }) => MenuItem[] \| null` | — | Right-click menu for body cells. Needs `menusFeature`. |
1254
+ | `headerMenu` | `boolean \| ({ column, items }) => MenuItem[] \| null` | `true` | Built-in header menu (sort, pin, move, hide, reset). Needs `menusFeature`. |
1255
+ | `ui` | `Partial<Record<'root' \| 'header' \| 'headerCell' \| 'row' \| 'cell' \| 'subgrid' \| 'detail' \| 'empty', ClassValue>>` | — | Extra classes per part (Tailwind-friendly). |
1256
+
1257
+ ### Events
1258
+
1259
+ `row-click(row, event)` · `cell-click({ row, rowKey, column, value, event })` (columns with `clickable: true`) ·
1260
+ `cell-action({ name, payload, row, rowKey, column })` (from renderers) · `sub-rows-error({ row, error })` · `context-action({ name, item, row, rowKey, column, value })` · `header-action({ name, item, column })` ·
1261
+ `query-change(query: GridQuery)` (sort + filters + page as one object, on mount and on every real change) ·
1262
+ `copy({ kind, text, rows, columns })` (rows or a cell were copied: `exportFeature`) ·
1263
+ `load-error(error)` (a `dataSource` call failed) ·
1264
+ plus the `update:*` events of every `v-model`.
1265
+
1266
+ Clicks on links, buttons and inputs inside a cell never trigger `row-click`.
1267
+
1268
+ ### Slots
1269
+
1270
+ `cell-<key>` (`{ row, value, rowKey, rowIndex, depth, column }`) · `header-<key>` (`{ column }`) ·
1271
+ `total-<key>` (`{ value, column, group? }`, a cell of the totals row or a group row) ·
1272
+ `group-<key>` (`{ value, count, rows, column, group }`, the value of a group row) · `detail` (`{ row, rowKey, depth }`) ·
1273
+ `toolbar` (`{ columns, columnState, setColumnState, filters, setFilters, clearFilters, activeFilterCount, selected, selectedCount, selectAllMatching, clearSelection }`) ·
1274
+ `empty` · `loading` · `sub-rows-loading` (`{ row }`).
1275
+
1276
+ ### Exposed methods
1277
+
1278
+ ```ts
1279
+ const grid = ref<VGridExposed>()
1280
+ grid.value?.scrollToTop() / scrollToRow(key) / expandAll() / collapseAll() / setColumnState(state)
1281
+ grid.value?.patchLoadedRows([{ id: 'c2', city: 'Niš' }]) // field updates for lazy children and dataSource rows
1282
+ grid.value?.setFilters({ columns: { city: { type: 'text', op: 'contains', value: 'nis' } } })
1283
+ grid.value?.clearFilters() / openFilter('city') / reload() // reload: re-run the dataSource query
1284
+ grid.value?.clearSelection() // selectionFeature: clears the selection, "all matching" included
1285
+ grid.value?.reloadSubRows('c2') // forget lazily loaded children (of one row, or all): they load again
1286
+ grid.value?.pinRow(42, 'top') // pin a row above the body ('bottom' below it, null to unpin): rowPinningFeature
1287
+ grid.value?.exportCsv({ filename: 'orders.csv' }) / getCsv() / copyRows() // exportFeature, see Export and copy
1288
+ ```
1289
+
1290
+ `reload()` also forgets lazily loaded children, as does passing a different `load-sub-rows`
1291
+ function. With `selection-mode="cascade"`, children that load under a selected parent arrive
1292
+ selected.
1293
+
1294
+ ### Partial updates
1295
+
1296
+ Changing part of the data re-renders only what changed — the table is never rebuilt:
1297
+
1298
+ - **Reactive rows** (`reactive()` / `ref()`): assign the field — `row.city = 'Niš'` — and only that
1299
+ cell re-renders.
1300
+ - **Immutable rows** (e.g. a `shallowRef` holding a large list): replace the changed rows and keep
1301
+ the others' identity. `patchRows(rows, patches, rowKey)` does exactly that for a batch of
1302
+ patches by key; only the patched rows re-render, and a batch that changes nothing returns the
1303
+ same array.
1304
+ - **Lazily loaded children** live in the grid's cache: use `grid.patchLoadedRows(patches)`.
1305
+
1306
+ Mutating a field in place under a `shallowRef` is not observed — assign a new array (`patchRows`)
1307
+ or use reactive rows.
1308
+
1309
+ **Change highlight.** `<VGrid flash>` briefly tints cells whose value changes (not on first render,
1310
+ not when a re-fetched row has equal values); `flash="direction"` tints numbers green when they rise
1311
+ and red when they fall. Columns override with `flash: false | true | 'direction'`. It's a CSS
1312
+ animation — tune it with `--vg-flash-color`, `--vg-flash-up`, `--vg-flash-down`,
1313
+ `--vg-flash-duration`. With `prefers-reduced-motion` the tint is held briefly instead of fading.
1314
+ The tint is a `::after` layer under the cell's content that fades with `opacity`, which browsers
1315
+ animate on the compositor (GPU): a busy live feed costs the main thread about a sixth of what a
1316
+ `background-color` animation would.
1317
+
1318
+ ### `ColumnDef<T>`
1319
+
1320
+ ```ts
1321
+ {
1322
+ key: string // unique; used by sort, column state and slot names
1323
+ header?: string; headerTooltip?: string
1324
+ field?: string // dot path, defaults to key
1325
+ value?: (row) => unknown // computed value, wins over field
1326
+ renderer?: RendererDefinition | string | Component // currencyRenderer (tree-shakeable), a registered name, or a component; default text
1327
+ rendererOptions?: object // typed from the renderer
1328
+ width?: string // any grid track: 'auto' (default), '8rem', '1fr', 'minmax(8rem, 2fr)', 'min-content'
1329
+ minWidth?: string // combined into minmax(minWidth, width); also the resize minimum
1330
+ maxWidth?: string // resize maximum (columnResizingFeature)
1331
+ resizable?: boolean // can the user resize it (columnResizingFeature, default true)
1332
+ group?: string // header group label (columnGroupsFeature)
1333
+ align?: 'start' | 'center' | 'end'
1334
+ sortable?: boolean; sortValue?: (row) => unknown; sortFn?: (a, b) => number
1335
+ pinned?: 'left' | 'right'; pinnable?: boolean // needs columnPinningFeature; pinnable: can the header menu change it (default true)
1336
+ hidden?: boolean; hideable?: boolean // need columnVisibilityFeature
1337
+ reorderable?: boolean // needs columnReorderFeature (default true)
1338
+ clickable?: boolean
1339
+ flash?: boolean | 'direction' // change highlight for this column (overrides the grid's `flash`)
1340
+ filterable?: boolean // funnel button in the header (and an input in the filter row)
1341
+ filter?: 'text' | 'number' | 'date' | 'boolean' | 'set'
1342
+ | { type?, options?: FilterOption[] | ((search, { signal }) => Promise<FilterOption[]>), placeholder? }
1343
+ filterValue?: (row) => unknown // value filters compare (default: the cell value)
1344
+ filterFn?: (row, filter) => boolean // replaces the built-in matching for this column
1345
+ filterComponent?: Component // custom popover body: props { modelValue, column }, emits update:modelValue
1346
+ searchable?: boolean // included in the quick search (default true for visible columns)
1347
+ aggregate?: 'sum' | 'avg' | 'min' | 'max' | 'count' | ((values, rows) => unknown) // totals row (aggregationFeature) and group rows
1348
+ groupable?: boolean // Group by / Ungroup in the header menu (rowGroupingFeature)
1349
+ groupValue?: (row) => unknown // what rows are grouped by (default: the cell value), e.g. the month of a date
1350
+ exportValue?: (row) => unknown // what CSV exports and copying use (exportFeature), e.g. an id instead of a link
1351
+ exportable?: boolean // in exports and copied rows (default true); false for action columns
1352
+ cellClass?: ClassValue | ((row) => ClassValue); headerClass?: ClassValue
1353
+ }
1354
+ ```
1355
+
1356
+ ## Selection and batch actions
1357
+
1358
+ `selectionFeature` adds a checkbox column. `v-model:selected` holds the selected row keys; the
1359
+ `#toolbar` slot gets them too, so a batch-action bar lives in the grid:
1360
+
1361
+ ```vue
1362
+ <VGrid v-model:selected="selected" :rows="requests" :columns="columns" row-key="id" selectable prune-selection
1363
+ :is-row-selectable="(r) => r.status === 'pending'" :features="[selectionFeature]">
1364
+ <template #toolbar="{ selected, selectedCount, clearSelection }">
1365
+ <template v-if="selectedCount">
1366
+ {{ selectedCount }} selected
1367
+ <button @click="approve(selected).then(clearSelection)">Approve</button>
1368
+ <button @click="clearSelection()">Clear</button>
1369
+ </template>
1370
+ </template>
1371
+ </VGrid>
1372
+ ```
1373
+
1374
+ - **Ranges.** Shift-click a checkbox (or Shift+Space with keyboard navigation) to give every row
1375
+ on screen from the last toggled one to this one the clicked row's new state. Ranges follow the
1376
+ display order (sort, filters, expanded sub-grids, open groups) and skip rows that can't be
1377
+ selected.
1378
+ - **Select all.** The header checkbox selects every selectable row that passes the filters, on
1379
+ every page; `selectable="single"` has radio buttons and no select-all.
1380
+ - **Rows that leave.** By default selected keys stay when their rows leave the data, so a
1381
+ selection can span server pages. `prune-selection` drops them instead: after a reload, a batch
1382
+ delete or a new page, `selected` only holds rows that exist.
1383
+ - **All matching rows (server data).** With a `data-source`, the header checkbox selects the loaded
1384
+ page; a banner then offers *Select all N rows* (N = the `total` the source returned). That sets
1385
+ `v-model:select-all-matching`: every row shows ticked, `selectedCount` is N, and your batch
1386
+ action should run on the query (`@query-change`) rather than on `selected`. Changing the
1387
+ filters, unticking a row (the keys already in `selected` stay, plus the rest of the loaded page) or
1388
+ *Clear selection* ends it.
1389
+ - `grid.clearSelection()` clears it all from code. Cascading through sub-grids, group checkboxes
1390
+ (row grouping) and copying the selected rows (export feature) work as described in their
1391
+ sections.
1392
+
1393
+ ## Sub-grids (CSS `subgrid`)
1394
+
1395
+ ```vue
1396
+ <VGrid :rows="markets" :columns="columns" row-key="id" :sub-rows="(row) => row.children" selectable />
1397
+ ```
1398
+
1399
+ Expanded children render inside a `.vg-subgrid` element that spans every column and uses
1400
+ `grid-template-columns: subgrid` — so each child cell sits exactly in its parent's column, at any
1401
+ depth. Children reuse the parent's columns: reorder, hide and pin apply automatically. The first
1402
+ column is indented per depth (`--vg-subgrid-indent`), rows get `aria-level`, the grid becomes a
1403
+ `treegrid`. With `loadSubRows` children are fetched on first expand.
1404
+
1405
+ Need children with a **different** set of columns? Put another `<VGrid>` in the `#detail` slot.
1406
+
1407
+ ## Column menu, reorder, persistence
1408
+
1409
+ ```vue
1410
+ <VGrid :rows :columns row-key="id" storage="orders-grid" :features="[columnVisibilityFeature, columnReorderFeature]">
1411
+ <!-- the picker hides columns (columnVisibilityFeature); dragging headers needs columnReorderFeature -->
1412
+ <template #toolbar="{ columnState, setColumnState }">
1413
+ <VGridColumnMenu :columns="columns" :column-state="columnState" @update:column-state="setColumnState($event!)" />
1414
+ </template>
1415
+ </VGrid>
1416
+ ```
1417
+
1418
+ With `columnReorderFeature`, drag a header to move it (mouse or pen; on a touch screen hold it for half a second first, see [Touch](#touch-phones-and-tablets)), or focus a header and press
1419
+ **Alt+←/→**. Pinned columns only move within their pin group. Stored state is reconciled with the
1420
+ current column definitions (unknown keys dropped, new columns appended).
1421
+
1422
+ ## Context menus
1423
+
1424
+ Menus use the **Popover API** (top layer — never clipped by the grid's scroll container; Esc and
1425
+ outside click close them) and **CSS anchor positioning** (`position-anchor` + `position-area` +
1426
+ `position-try-fallbacks`): they flip to stay on screen and follow their anchor while the grid
1427
+ scrolls. No JS positioning, except a small fallback for browsers without anchor positioning.
1428
+
1429
+ ### Body cells
1430
+
1431
+ ```vue
1432
+ <VGrid
1433
+ :rows :columns row-key="id"
1434
+ :context-menu="({ row, column, value }) => column.key === 'link' ? [] : [
1435
+ { name: 'copy', label: 'Copy', hint: 'Ctrl+C' },
1436
+ { name: 'open', label: `Open #${row.id}` },
1437
+ { separator: true },
1438
+ { name: 'delete', label: 'Delete', tone: 'danger', disabled: !row.canDelete },
1439
+ ]"
1440
+ @context-action="({ name, row, column, value }) => run(name, row)"
1441
+ />
1442
+ ```
1443
+
1444
+ Right-click opens the menu at the pointer; the **ContextMenu** key or **Shift+F10** opens it under the
1445
+ focused cell. Return `[]`/`null` to keep the browser's native menu for that cell. Items:
1446
+ `{ name, label, disabled?, tone?, icon?, hint? }` or `{ separator: true }`. Arrow keys, Home/End and
1447
+ typeahead move through items; focus returns to the cell on close.
1448
+
1449
+ ### Column headers
1450
+
1451
+ Right-clicking a header opens a built-in menu: **Sort ascending / descending / Clear sort** (sortable
1452
+ columns), **Pin left / Pin right / Unpin**, **Move left / right**, **Hide column**, **Reset columns**.
1453
+ Pin items need `columnPinningFeature`, move items `columnReorderFeature`, Hide column `columnVisibilityFeature`. Runtime pins are stored in column state (`columnState.pinned`) and persisted with `storage`.
1454
+
1455
+ ```vue
1456
+ <!-- extend (or replace) the built-in items; custom items emit header-action -->
1457
+ <VGrid :header-menu="({ column, items }) => [{ name: 'copy', label: 'Copy column' }, { separator: true }, ...items]"
1458
+ @header-action="({ name, column }) => …" />
1459
+ <VGrid :header-menu="false" /> <!-- off -->
1460
+ ```
1461
+
1462
+ Columns opt out with `pinnable: false`, `reorderable: false`, `hideable: false`.
1463
+
1464
+ ### `VGridMenu` for your own triggers
1465
+
1466
+ The same component powers the `actions-menu` renderer and is exported for add-ons:
1467
+
1468
+ ```vue
1469
+ <button popovertarget="row-menu" :style="{ 'anchor-name': '--row-menu' }">⋮</button>
1470
+ <VGridMenu id="row-menu" anchor-name="--row-menu" :items="items" @select="(item) => …" />
1471
+ <!-- or imperatively: menuRef.value.openAt(element | { x, y }) -->
1472
+ ```
1473
+
1474
+ ## Filtering
1475
+
1476
+ ```vue
1477
+ <script setup lang="ts">
1478
+ import { VGrid, VGridSearch, filteringFeature, numberRenderer, statusRenderer, type FilterState } from '@nocopypaste/vue-grid'
1479
+
1480
+ const filters = ref<FilterState | null>(null)
1481
+ const columns = [
1482
+ { key: 'player', header: 'Player', filterable: true }, // text
1483
+ { key: 'stake', header: 'Stake', filterable: true, renderer: numberRenderer }, // number (from the renderer)
1484
+ { key: 'status', header: 'Status', filterable: true, renderer: statusRenderer },// value list
1485
+ { key: 'placedAt', header: 'Placed', filterable: true, filter: 'date' }, // explicit type
1486
+ ]
1487
+ </script>
1488
+
1489
+ <template>
1490
+ <VGrid v-model:filters="filters" :rows :columns row-key="id" :features="[filteringFeature]"
1491
+ filter-row filter-storage="bets-filters">
1492
+ <template #toolbar="{ activeFilterCount, clearFilters }">
1493
+ <VGridSearch />
1494
+ <button v-if="activeFilterCount" @click="clearFilters()">Clear {{ activeFilterCount }} filters</button>
1495
+ </template>
1496
+ </VGrid>
1497
+ </template>
1498
+ ```
1499
+
1500
+ - **Header funnel.** Each `filterable` column gets a funnel button. It is hidden until you hover the
1501
+ header (on devices that can hover) and stays visible while a filter is active. It opens a
1502
+ popover through the Popover API and CSS anchor positioning, and the popover holds an editor for
1503
+ the column's type:
1504
+
1505
+ | Type | Editor | Operators |
1506
+ |---|---|---|
1507
+ | `text` | operator + value | contains, does not contain, equals, does not equal, starts with, ends with, is empty, is not empty |
1508
+ | `number` | operator + value(s) | `=` `≠` `<` `≤` `>` `≥`, between, is empty, is not empty |
1509
+ | `date` | operator + date(s) | on, before, after, between, is empty, is not empty |
1510
+ | `boolean` | radio group | any, yes, no, empty |
1511
+ | `set` | searchable checkbox list with counts | (the selected values) |
1512
+ | `custom` | your `filterComponent` | (anything; match it with `filterFn`) |
1513
+
1514
+ The type comes from `filter`, else from the renderer (number, currency, change → `number`;
1515
+ date, datetime → `date`; boolean, checkbox, switch → `boolean`; status, chip → `set`), else
1516
+ `text`.
1517
+ - **Filter row** (`filter-row`). An inline input under each header that accepts shorthand:
1518
+ `>10`, `>=10`, `5..20`, `-5..-1`, open ranges `5..` / `..20`, `!=3`, a decimal comma (`1,5`),
1519
+ and `>2026-01-01` or `2026-01-01..2026-03-31` for dates; plain text for text columns. Input that
1520
+ doesn't parse sets no filter. Boolean columns get a select; value-list and custom columns get a
1521
+ button that opens the popover.
1522
+ - **Quick search.** `<VGridSearch>` inside the `#toolbar` slot drives that grid's search. Anywhere
1523
+ else, bind it with `v-model` to `filters.search`. The search matches any visible column that is
1524
+ not marked `searchable: false`.
1525
+ - **Matching** is case- and accent-insensitive (`nis` finds *Niš*). Dates compare by calendar day
1526
+ in the grid's `timeZone`; a date-only string (`2026-01-05`) is that calendar day in every time
1527
+ zone, for filtering and for the `date` renderer. Column filters combine with AND, and then the
1528
+ search must match too. Saved filters for columns that no longer exist are ignored.
1529
+ - **Long value lists** render their first 300 values; a search narrows the rest.
1530
+ - **Trees.** A row shows when it matches, when a descendant matches (so the path stays visible), or
1531
+ when an ancestor matched (so a matching group keeps its children). Select-all and cascade only
1532
+ touch rows that are visible.
1533
+ - **Value lists from a backend.** Pass `filter: { type: 'set', options: (search, { signal }) => fetch(…) }`.
1534
+ The list is fetched when the popover opens and again on every search (debounced). Superseded
1535
+ requests are cancelled.
1536
+ - The header menu has **Filter… / Clear filter / Clear all filters** items. When filters hide
1537
+ every row, the grid shows `noMatchText` with a *Clear filters* button.
1538
+
1539
+ The model is plain JSON, so you can store it, put it in the URL or send it to an API as is:
1540
+
1541
+ ```ts
1542
+ interface FilterState { columns: Record<string, ColumnFilter>; search?: string }
1543
+ type ColumnFilter =
1544
+ | { type: 'text'; op: 'contains' | 'notContains' | 'equals' | 'notEquals' | 'startsWith' | 'endsWith' | 'empty' | 'notEmpty'; value?: string }
1545
+ | { type: 'number'; op: 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'between' | 'empty' | 'notEmpty'; value?: number | null; to?: number | null }
1546
+ | { type: 'date'; op: 'on' | 'before' | 'after' | 'between' | 'empty' | 'notEmpty'; value?: string; to?: string } // YYYY-MM-DD
1547
+ | { type: 'boolean'; value: boolean | null }
1548
+ | { type: 'set'; values: string[] } // '' stands for blank cells
1549
+ | { type: 'custom'; value: unknown }
1550
+ ```
1551
+
1552
+ The matchers are exported too, for use on a server or in tests: `matchesFilter`,
1553
+ `parseQuickFilter`, `filterTree`, `isFilterActive`, `activeFilterCount`, `foldText`.
1554
+
1555
+ **Custom filter.** A `filterComponent` gets `{ modelValue, column }` and emits
1556
+ `update:modelValue` with a filter (or `undefined` to clear it). Pair it with `filterFn(row, filter)`.
1557
+
1558
+ ## Server data
1559
+
1560
+ Two ways to connect sorting, filtering and paging to a backend.
1561
+
1562
+ **1. `dataSource`: the grid fetches.** You give it a function. The grid calls it on mount and
1563
+ whenever sort, filters, page or page size change. It does not sort, filter or slice the rows
1564
+ itself; it shows exactly what the function returns.
1565
+
1566
+ ```vue
1567
+ <script setup lang="ts">
1568
+ import { filteringFeature, paginationFeature, serverDataFeature, sortingFeature, type DataSource } from '@nocopypaste/vue-grid'
1569
+
1570
+ const fetchBets: DataSource<Bet> = async (query, { signal }) => {
1571
+ // query: { sort: { key, dir } | null, filters: FilterState, page: number, pageSize: number | null }
1572
+ const res = await fetch('/api/bets', { method: 'POST', body: JSON.stringify(query), signal })
1573
+ if (!res.ok) throw new Error(res.statusText)
1574
+ return res.json() // { rows: Bet[], total?: number }
1575
+ }
1576
+ </script>
1577
+
1578
+ <template>
1579
+ <VGrid ref="grid" :data-source="fetchBets" :columns row-key="id" pagination filter-row @load-error="toast"
1580
+ :features="[serverDataFeature, sortingFeature, filteringFeature, paginationFeature]" />
1581
+ </template>
1582
+ ```
1583
+
1584
+ - **Cancellation.** A new query aborts the previous request through `signal`, and a late response
1585
+ from a superseded request is ignored, so fast typing never shows stale rows.
1586
+ - **States.** The grid shows a progress bar while loading. If the function throws, it shows
1587
+ *Couldn't load the rows.* with a *Retry* button and emits `load-error`.
1588
+ - **Paging.** `pagination` adds the pager and sends `page` / `pageSize`; return `total` so the
1589
+ pager knows how many pages there are. Without `pagination`, `pageSize` is `null` (fetch
1590
+ everything). The page resets to 1 when sort or filters change.
1591
+ - `grid.reload()` re-runs the current query, and `grid.patchLoadedRows(patches)` updates fields of
1592
+ rows that are already loaded without a refetch.
1593
+
1594
+ **2. `@query-change`: you fetch.** Keep `rows` under your control, set `sort-mode="controlled"`
1595
+ and `filter-mode="controlled"`, and handle one event. The grid emits the combined query on mount
1596
+ and on every change, and skips duplicates:
1597
+
1598
+ ```vue
1599
+ <VGrid :rows="rows" :columns row-key="id" :loading="loading" :features="[sortingFeature, filteringFeature]"
1600
+ sort-mode="controlled" filter-mode="controlled" @query-change="load" />
1601
+ ```
1602
+
1603
+ Use this when the data comes from a store, a WebSocket or a GraphQL client that you already manage.
1604
+
1605
+ ## Pagination
1606
+
1607
+ `pagination` gives you a built-in pager under the grid. With client rows it slices the sorted and
1608
+ filtered rows; with a `dataSource` it requests pages.
1609
+
1610
+ ```vue
1611
+ <VGrid :rows :columns row-key="id" :features="[paginationFeature]" :pagination="{ pageSizes: [10, 25, 50] }" v-model:page="page" v-model:page-size="pageSize" />
1612
+ ```
1613
+
1614
+ Or place the standalone component yourself and feed the grid one page at a time:
1615
+
1616
+ ```vue
1617
+ <VGrid v-model:sort="sort" :rows="pageRows" :columns row-key="id" :loading="loading" :features="[sortingFeature]" />
1618
+ <VGridPagination v-model:page="page" v-model:page-size="pageSize" :total="total" :page-sizes="[10, 25, 50]" />
1619
+ ```
1620
+
1621
+ ## Pinned rows and totals
1622
+
1623
+ Rows that stay in view while the body scrolls: a totals row (`aggregationFeature`) and rows pinned
1624
+ above or below the body (`rowPinningFeature`).
1625
+
1626
+ ```vue
1627
+ <script setup lang="ts">
1628
+ const columns = [
1629
+ col({ key: 'player', aggregate: 'count' }),
1630
+ col({ key: 'stake', renderer: currencyRenderer, aggregate: 'sum' }),
1631
+ col({ key: 'odds', renderer: numberRenderer, aggregate: 'avg' }),
1632
+ col({ key: 'placedAt', renderer: dateRenderer, aggregate: 'max' }),
1633
+ ]
1634
+ const pinned = ref<PinnedRowsState>({ top: [42] })
1635
+ </script>
1636
+
1637
+ <template>
1638
+ <VGrid :rows="bets" :columns="columns" row-key="id" totals v-model:pinned-rows="pinned" />
1639
+ </template>
1640
+ ```
1641
+
1642
+ - **Totals.** `totals` (or `totals="bottom"`) adds a totals row at the bottom; `totals="top"`
1643
+ puts it under the header. Each column with an `aggregate` shows it with the column's own
1644
+ renderer (so a currency column sums to a currency), `count` as a plain number; the first column
1645
+ shows `totals-label` (`'Total'`) unless it has an aggregate. `sum` / `avg` skip values that
1646
+ aren't numbers, `min` / `max` compare numbers, dates and strings, and a function gets the
1647
+ column's values and the rows. The totals cover the top-level rows that pass the filters, on
1648
+ every page (child rows aren't counted), and follow live data. With server data the grid only
1649
+ has the current page: pass the server's totals as `aggregates` (`{ stake: 125000 }`), which
1650
+ wins over computed values. The `total-<key>` slot renders a cell of the row yourself.
1651
+ - **Pinned rows.** `v-model:pinned-rows` (`{ top, bottom }`, row keys, in display order) or
1652
+ `grid.pinRow(key, 'top' | 'bottom' | null)` pins top-level rows. They leave the body, stay put
1653
+ while it scrolls, and aren't filtered, sorted or paged; selection, row clicks and context menus
1654
+ still work on them. Pin from your own context menu: `@context-action` → `pinRow(rowKey, …)`.
1655
+ - **Extra rows.** `pinned-top-rows` / `pinned-bottom-rows` show rows that aren't part of `rows`
1656
+ (a target, last year's figures) — no checkbox, not counted in the totals.
1657
+
1658
+ Each section is one sticky `subgrid` container, so its rows share the grid's columns, follow
1659
+ resizing, reordering and pinned columns, and need no measuring of their own. Keyboard navigation
1660
+ moves through them like any row, and a focused row scrolls clear of them (`scroll-padding`).
1661
+ With virtual scrolling, `aria-rowindex` / `aria-rowcount` count them. Style them with
1662
+ `.vg-pinned-top`, `.vg-pinned-bottom`, `.vg-row-pinned`, `.vg-row-total` and the
1663
+ `--vg-total-row-bg` / `--vg-total-row-font-weight` tokens.
1664
+
1665
+ ## Row grouping
1666
+
1667
+ `rowGroupingFeature` groups the rows by one or more columns. Each group is a row with the grouped
1668
+ column's name, the value, the number of rows and each column's `aggregate` over the group; expand
1669
+ it to see its sub-groups or, at the last level, its rows.
1670
+
1671
+ ```vue
1672
+ <script setup lang="ts">
1673
+ const columns = [
1674
+ col({ key: 'player', field: 'player.name' }),
1675
+ col({ key: 'city', field: 'player.city', groupable: true }),
1676
+ col({ key: 'status', renderer: statusRenderer, groupable: true }),
1677
+ col({ key: 'stake', renderer: currencyRenderer, aggregate: 'sum' }),
1678
+ col({ key: 'placedAt', renderer: dateRenderer, groupable: true, groupValue: (b) => b.placedAt.slice(0, 7) }),
1679
+ ]
1680
+ const groupBy = ref(['status', 'city'])
1681
+ </script>
1682
+
1683
+ <template>
1684
+ <VGrid v-model:group-by="groupBy" :rows="bets" :columns="columns" row-key="id" totals
1685
+ :features="[rowGroupingFeature, aggregationFeature]" />
1686
+ </template>
1687
+ ```
1688
+
1689
+ - **What a group shows.** The first column holds the expander, the grouped column's header, the
1690
+ value (with that column's renderer, so a status groups under its badge; a `groupValue` shows as
1691
+ text) and the row count. That cell runs across the columns after it up to the first one with
1692
+ an `aggregate`; those show the group's own aggregate. The `group-<key>` slot renders the value
1693
+ yourself (`{ value, count, rows, column, group }`); `total-<key>` also renders group cells
1694
+ (with `group` set). Empty values form a `(blank)` group, last.
1695
+ - **Order, filters, pages.** Groups follow the filters and are ordered by value, descending when
1696
+ the grid is sorted descending by the grouped column; sorting by any other column orders the
1697
+ rows inside each group. Pagination pages the top-level groups. With server data, the rows of
1698
+ the current page are grouped.
1699
+ - **Expanding.** Groups start collapsed (`groups-expanded` opens them). Click a group's label or its
1700
+ arrow, or use →/← with keyboard navigation; `expandAll()` / `collapseAll()` include groups.
1701
+ Changing `group-by` starts over.
1702
+ - **Selection.** A group's checkbox selects or clears every row in it, and shows partly
1703
+ selected groups as indeterminate.
1704
+ - **Header menu.** Columns with `groupable: true` get *Group by* (adds a level) / *Ungroup*, and
1705
+ *Ungroup all*. Any column can be grouped through `v-model:group-by`.
1706
+ - **Virtual scrolling.** Group rows are part of the virtual layout: thousands of rows in a few
1707
+ groups render only what's in view.
1708
+
1709
+ Style group rows with `.vg-rowgroup` (and `[data-group-level]`), `.vg-rowgroup-name`,
1710
+ `.vg-rowgroup-value`, `.vg-rowgroup-count` and the `--vg-rowgroup-bg` /
1711
+ `--vg-rowgroup-font-weight` tokens. `groupRows()` and `isRowGroup()` are exported for using the
1712
+ same grouping elsewhere.
1713
+
1714
+ ## Export and copy
1715
+
1716
+ `exportFeature` turns the grid's rows into CSV and copies them to the clipboard.
1717
+
1718
+ ```vue
1719
+ <script setup lang="ts">
1720
+ const grid = ref<VGridExposed>()
1721
+ const columns = [
1722
+ col({ key: 'customer', field: 'customer.name' }),
1723
+ col({ key: 'total', renderer: currencyRenderer, aggregate: 'sum' }),
1724
+ col({ key: 'link', renderer: linkRenderer, exportValue: (o) => o.id }), // export the id, not the link
1725
+ col({ key: 'actions', renderer: actionsMenuRenderer, exportable: false }), // left out
1726
+ ]
1727
+ </script>
1728
+
1729
+ <template>
1730
+ <button @click="grid?.exportCsv({ filename: 'orders.csv', totals: true })">Download CSV</button>
1731
+ <button @click="grid?.copyRows()">Copy selected</button>
1732
+ <VGrid ref="grid" :rows="orders" :columns="columns" row-key="id" selectable totals
1733
+ :features="[exportFeature, selectionFeature, aggregationFeature, keyboardNavigationFeature]"
1734
+ @copy="(e) => toast(`Copied ${e.rows.length} rows`)" />
1735
+ </template>
1736
+ ```
1737
+
1738
+ - **`exportCsv(options)`** downloads a `.csv` file (`filename`, default `export.csv`) in UTF-8 with
1739
+ a BOM, so Excel shows accents right (`bom: false` to drop it). **`getCsv(options)`** returns the
1740
+ same text, for uploading or previewing.
1741
+ - **`copyRows(options)`** copies rows as tab-separated text, which pastes as cells into Excel,
1742
+ Google Sheets or Numbers. It resolves `false` when nothing was copied.
1743
+ - **Ctrl / ⌘ + C** inside the grid copies the selected rows; with none selected, the focused cell
1744
+ (cells take focus with `keyboardNavigationFeature`). A text selection, or focus in an input,
1745
+ is left to the browser.
1746
+ - **Options** (all methods): `rows` — `'filtered'` (default for exports: the rows that pass the
1747
+ filters, sorted, every page), `'all'`, `'page'`, `'selected'` (default for copying, nested rows
1748
+ included); `children: true` adds the known sub-grid rows after their parent; `columns` — keys,
1749
+ in order, hidden columns allowed (default: the visible columns without `exportable: false`);
1750
+ `values` — `'raw'` (default for exports: numbers and ISO dates a spreadsheet can compute with)
1751
+ or `'formatted'` (default for copying: as the cells show them); `header` (default `true` for
1752
+ exports, `false` for copying); `totals: true` adds the totals row; `delimiter` (`,` / tab);
1753
+ `guard` (default `true`).
1754
+ - **Values.** A column's `exportValue(row)` wins. Formatted values come from the renderer's
1755
+ `format` (numbers, currency, change, dates, date-times, booleans, status, chips and lists have
1756
+ one; your own renderers can add it); other values are written as text: dates in ISO 8601,
1757
+ arrays joined with `, `, objects as JSON. Grouped grids export their rows, not the group rows.
1758
+ - **Safe for spreadsheets.** Fields are quoted per RFC 4180, and text that a spreadsheet would run
1759
+ as a formula (`=…`, `+…`, `-…`, `@…`) gets a leading `'`; numbers are left alone.
1760
+ - **Clipboard.** Copying uses the Clipboard API and falls back to the browser's copy command where
1761
+ that API is missing or refused (pages served over plain http), as does the copy button of
1762
+ text cells.
1763
+
1764
+ Without the grid: `toCsv(rows, columns, { delimiter, header, guard })` writes CSV from any rows
1765
+ and column definitions (raw values, `exportValue`, `exportable`); `toDelimited(table)`,
1766
+ `plainText(value)` and `guardFormula(text)` are its parts.
1767
+
1768
+ ## Virtual scrolling
1769
+
1770
+ ```vue
1771
+ <VGrid :rows="tenThousandRows" :columns row-key="id" :features="[virtualScrollingFeature]"
1772
+ :virtual="{ rowHeight: 40 }" style="height: 600px" />
1773
+ ```
1774
+
1775
+ Rows have a fixed height; only the visible window plus `overscan` is rendered.
1776
+
1777
+ Sub-grids and detail rows work in virtual mode too. The DOM keeps the same CSS grid / `subgrid`
1778
+ structure as without it: expanded children stay inside their parent's `subgrid` container (lined up
1779
+ with its columns), and at every level the rows out of view are replaced by spacers, so an expanded
1780
+ tree of tens of thousands of rows still renders about a screenful.
1781
+
1782
+ - **Data rows** (children too) have `rowHeight`.
1783
+ - **Detail rows** can be any height. They're measured once rendered; until then
1784
+ `virtual.detailHeight` is the estimate (default 4 × `rowHeight`).
1785
+ - **Lazy children** (`load-sub-rows`) are requested only for expanded rows in view, once a scroll
1786
+ has settled, so flying past expanded rows doesn't fire their requests.
1787
+ - **The view holds still** when rows above it change height (a detail row measured, children
1788
+ loaded): the grid keeps the first row in view where it was. It does this itself, the same in every
1789
+ browser, so virtual grids set `overflow-anchor: none` (browser scroll anchoring doesn't work
1790
+ reliably in a CSS grid like this one — Firefox doesn't anchor in it at all).
1791
+ - `scrollToRow(key)` reaches child rows too; `aria-rowcount` / `aria-rowindex` count every
1792
+ rendered row (data, detail and loading / error rows).
1793
+
1794
+ ## Performance
1795
+
1796
+ What the grid does for you, and what helps on your side. The repository README lists the
1797
+ measurements.
1798
+
1799
+ **Many rows.** Above a few hundred rows, turn on `virtualScrollingFeature` and give the grid a
1800
+ fixed height. Without it, every row is in the DOM, and restyling or relayout (resizing the window,
1801
+ switching density) touches every cell. Tips:
1802
+
1803
+ - Keep `rowHeight` exact and cell content to one line (e.g. `rendererOptions: { ellipsis: true }`).
1804
+ - Set `detailHeight` close to your typical detail row: rows that render near their estimate settle
1805
+ without visible correction.
1806
+ - Raise `overscan` (default 6) only if fast scrolling shows blank rows on slow devices.
1807
+
1808
+ **Changing data.** Re-render only what changed:
1809
+
1810
+ - Reactive rows: assign the field (`row.status = 'Won'`); only that cell re-renders.
1811
+ - Large immutable lists (`shallowRef`): `patchRows(rows, patches, rowKey)` replaces just the patched
1812
+ rows, and a batch that changes nothing returns the same array.
1813
+ - Lazily loaded children live in the grid: use `grid.patchLoadedRows(patches)`.
1814
+ - For a live feed, batch patches per animation frame rather than per message.
1815
+
1816
+ **Filtering and sorting** are built for large client-side data:
1817
+
1818
+ - Filtering is one pass over the tree. Date filters reuse one formatter per time zone, and text
1819
+ matching has an ASCII fast path.
1820
+ - Value lists are counted once per column, and long lists render 300 values with a search to
1821
+ narrow them.
1822
+ - Sorting computes each row's value once, with a shared collator.
1823
+ - For much larger data, or data that lives on a server, use `data-source` (server mode).
1824
+
1825
+ **Lazy children** (`load-sub-rows`) are requested when an expanded row renders. Without virtual
1826
+ scrolling that is every expanded row. With it, only expanded rows on screen, and only once a scroll
1827
+ settles, so `expandAll()` on thousands of lazy rows sends a screenful of requests, not thousands.
1828
+
1829
+ **Motion** stays on the compositor: the change highlight (`flash`) fades an `opacity` layer, the
1830
+ resize handle grows with `transform`, and spinners and progress bars use `transform`. Row
1831
+ highlights appear instantly and fade out over `--vg-transition`.
1832
+
1833
+ **Bundle.** Import only the features and renderers you use. Everything else is tree-shaken, and
1834
+ the filter popover, filter-row editors and pager are separate chunks loaded on first use.
1835
+
1836
+ ## Keyboard
1837
+
1838
+ Without `keyboardNavigationFeature` the grid is an ARIA `table`. The scroll area is one Tab stop,
1839
+ and the grid's own controls (sort buttons, expanders, checkboxes, filter buttons) follow in the
1840
+ normal Tab order.
1841
+
1842
+ With `keyboardNavigationFeature` it is an ARIA `grid` (`treegrid` with sub-grids). The grid is one tab stop. Arrow keys move between cells (header, rows, sub-grid rows, detail rows),
1843
+ `Home`/`End`, `Ctrl+Home`/`Ctrl+End`, `PageUp`/`PageDown`; `ContextMenu` / `Shift+F10` opens the context menu. `Enter` sorts a header or activates the
1844
+ cell's control; `Space` toggles row selection; `→`/`←` on a tree cell expands/collapses; `Alt+←/→` on a
1845
+ header moves the column; `Alt+Shift+←/→` on a header resizes it (with `columnResizingFeature`).
1846
+
1847
+ ## Touch, phones and tablets
1848
+
1849
+ - **Layout.** The grid scrolls its columns inside its own frame at any width; it doesn't widen
1850
+ the page, also inside flex and grid layouts (`.vg-root` has `min-width: 0`). If you wrap it in
1851
+ your own element inside a flex or grid layout, give that element `min-width: 0` too, or it
1852
+ grows to the columns' width. The toolbar wraps, and on narrow screens the pager drops its
1853
+ « / » buttons (page 1 and the last page stay).
1854
+ - **Swipes scroll** the grid, also when they start on a header (except on a column's narrow
1855
+ resize edge).
1856
+ - **Hold a header** (about half a second) to pick the column up, then drag it to reorder
1857
+ (`columnReorderFeature`). Release it without moving to open the header menu (`menusFeature`).
1858
+ - **Hold a body cell**, then release, to open its `context-menu`. This works on iOS, which fires no
1859
+ `contextmenu` event; the browser's own long-press menu is suppressed while the grid's menu
1860
+ takes over.
1861
+ - Inputs (filters, search, pager) are 16 px on touch screens so iOS Safari doesn't zoom in, and
1862
+ row hover tints only apply where there is a real hover (a tapped row doesn't stay tinted).
1863
+
1864
+ ## Built-in renderers
1865
+
1866
+ Screenshots of every renderer are in the repository README's
1867
+ [renderer gallery](../../README.md#29-cell-renderers).
1868
+
1869
+ **Display**
1870
+
1871
+ | Name | Options |
1872
+ |---|---|
1873
+ | `text` (default) | `ellipsis`, `lines`, `maxWidth`, `preserveNewlines`, `tooltip`, `placeholder`, `tone`, `toneMode` (`text`/`fill`), `bold`, `secondary` (muted suffix), `badge` + `badgePosition`, `icon`, `copyable` + `copyValue` → emits `copy` |
1874
+ | `toggle-text` | `clickable`, `highlighted` → emits `toggle` |
1875
+ | `number`, `signed-number` | `format` (`Intl.NumberFormatOptions`), `placeholder`, `clickable` → emits `click` |
1876
+ | `currency` | `currency` (code or `(value, row) => code`), `format`, `placeholder`, `clickable` → emits `click` |
1877
+ | `change` | `direction`, `currency`, `format`, `iconOnly` (arrow + colour; booleans / `'true'` = trend) |
1878
+ | `date`, `datetime` | `format`, `placeholder`; `datetime`: `milliseconds`, `twoLines` |
1879
+ | `boolean` | `trueLabel`, `falseLabel`, `nullLabel`, `display` (`text`/`icon`), `falseIcon` |
1880
+ | `status` | `tone` (map / fn / constant), `label` (fn or value → label map), `dot`, `variant` (`soft`/`solid`/`outline`), `placeholder`, `clickable` → emits `click` |
1881
+ | `chip` | `color` (any CSS colour, contrast text picked), `tone`, `label`, `tooltip`, `shape` (`square`/`circle`/`pill`), `size`; accepts `{ label \| name, color, description }` |
1882
+ | `multi-line` | `lines` (builder; default: the value array), `boldLines`, `ellipsis`, `target`, `placeholder`; each line: `{ text, href, to, tone, fill, bold, muted, tooltip, trend, action, badge }` |
1883
+ | `list` | `items`, `itemLabel`, `max` (default 1), `placeholder` → “+N more” toggle, emits `expand` |
1884
+ | `link` | `href`, `to` (router location → `<RouterLink>` when vue-router is installed), `label`, `target`, `tooltip` → emits `click` |
1885
+ | `icon` | `icon` / `iconFor`, `show`, `label`, `tone` |
1886
+ | `image` | `src`, `baseUrl`, `alt`, `size`, `fit`, `shape`; placeholder when empty or broken |
1887
+ | `code` | `language` (`auto`/`json`/`text`), `lines`, `indent`, `highlight` (JSON token colours) |
1888
+ | `json` | `label`, `dialogTitle` (escaped JSON in a `<dialog>`) |
1889
+ | `json-tree` | `collapseAt`, `maxDepth`, `parseNested`, `collapsed` + `toggleLabel`, `emptyText` |
1890
+ | `details` | `tone`, `label`, `items` (`{ label, value, tone, detail, tooltip }[]`), `title`, `triggerLabel` → badge + info popover |
1891
+
1892
+ **Actions and editing** — editable renderers are *controlled*: they show the data and emit the requested
1893
+ change; your `@cell-action` handler updates the row.
1894
+
1895
+ | Name | Options → emits |
1896
+ |---|---|
1897
+ | `actions-menu` | `actions: MenuItem[] \| (row) => MenuItem[]`, `label` → the item's `name` |
1898
+ | `action-button` | `label`, `action`, `icon`, `tone`, `disabled`, `visible`, `variant` (`outline`/`solid`/`ghost`), `iconOnly` → `action` (default `click`) |
1899
+ | `button-group` | `buttons: ButtonSpec[] \| (row) => ButtonSpec[]` (`{ name, label, tone, variant, disabled, icon, hidden }`) → the button's `name` |
1900
+ | `copy` | `copyValue`, `iconOnly`, `title`, `label`, `placeholder` → `copy` (payload: copied text) / `copy-error` |
1901
+ | `edit` | `format`, `placeholder`, `label`, `disabled`, `bold` → `edit` |
1902
+ | `checkbox`, `switch` | `checked`, `disabled`, `disabledReason`, `label` → `change` (payload: the requested boolean) |
1903
+ | `radio` | same + `name` → `select` (payload: the row key) |
1904
+ | `icon-toggle` | `active`, `icon`, `activeIcon`, `activeTone`, `label`, `disabled` → `toggle` (payload: next state) |
1905
+
1906
+ ```vue
1907
+ <VGrid :rows="rows" :columns="[{ key: 'web', renderer: 'switch' }]" row-key="id"
1908
+ @cell-action="({ name, payload, rowKey }) => name === 'change' && setWeb(rowKey, payload)" />
1909
+ ```
1910
+
1911
+ Values option callbacks receive `(value, row)`. The component of every renderer is exported too
1912
+ (`TextCell`, `CurrencyCell`, …) for composition.
1913
+
1914
+ ## Writing a cell renderer (addons)
1915
+
1916
+ A renderer is a component plus a small definition. See
1917
+ [`@nocopypaste/vue-grid-renderer-template`](../cell-renderer-template) for a complete, publishable example.
1918
+
1919
+ ```vue
1920
+ <!-- RatingCell.vue -->
1921
+ <script setup lang="ts">
1922
+ import type { CellRendererEmits, CellRendererProps } from '@nocopypaste/vue-grid'
1923
+ const props = defineProps<CellRendererProps<unknown, number, { max?: number }>>()
1924
+ const emit = defineEmits<CellRendererEmits>()
1925
+ </script>
1926
+ <template>
1927
+ <button v-for="n in options.max" :key="n" @click="emit('action', 'rate', n)">{{ n <= value ? '★' : '☆' }}</button>
1928
+ </template>
1929
+ ```
1930
+
1931
+ ```ts
1932
+ import { defineCellRenderer } from '@nocopypaste/vue-grid'
1933
+ declare module '@nocopypaste/vue-grid' {
1934
+ interface CellRendererRegistry { rating: { max?: number } } // typed `renderer: 'rating'`
1935
+ }
1936
+ export const ratingRenderer = defineCellRenderer<{ max?: number }>({
1937
+ name: 'rating', component: RatingCell, defaults: { max: 5 }, sortValue: (v) => Number(v),
1938
+ // what Ctrl+C and formatted CSV exports copy (export feature); without it the raw value
1939
+ format: (v, options, ctx, row) => `${Number(v ?? 0)} of ${options.max ?? 5}`,
1940
+ })
1941
+ // app.use(createVueGrid({ renderers: [ratingRenderer] })) or <VGrid :renderers="[ratingRenderer]">
1942
+ ```
1943
+
1944
+ Renderer props: `value`, `row`, `rowKey`, `rowIndex`, `depth`, `column`, `options` (defaults merged
1945
+ with `rendererOptions`). Emit `action(name, payload)`; the grid re-emits it as `cell-action` with the
1946
+ row and column. `useGridContext()` gives `{ locale, currency, timeZone }`. Lookup order:
1947
+ a definition or component on the column → `:renderers` → plugin → `text` (the only renderer built in).
1948
+
1949
+ ## Theming
1950
+
1951
+ Override any token on `:root`, a wrapper, or the grid itself:
1952
+
1953
+ ```css
1954
+ .brand-grid {
1955
+ --vg-color-accent: #db2777;
1956
+ --vg-color-header-bg: #fdf2f8;
1957
+ --vg-radius: 1rem;
1958
+ --vg-cell-padding-x: 1.25rem;
1959
+ --vg-font-family: Georgia, serif;
1960
+ }
1961
+ ```
1962
+
1963
+ | Group | Tokens |
1964
+ |---|---|
1965
+ | Type | `--vg-font-family` `--vg-font-size` `--vg-line-height` `--vg-header-font-size` `--vg-header-font-weight` `--vg-header-letter-spacing` `--vg-header-text-transform` |
1966
+ | Colour | `--vg-color-text` `-text-muted` `-surface` `-surface-raised` `-header-bg` `-header-text` `-border` `-border-strong` `-row-hover` `-row-selected` `-row-highlight` `-accent` `-accent-contrast` `-focus-ring` `-success` `-danger` `-warning` `-info` `-neutral` |
1967
+ | Space & shape | `--vg-cell-padding-x/y` `--vg-header-padding-x/y` `--vg-gap` `--vg-radius` `--vg-radius-sm` `--vg-radius-pill` `--vg-border-width` `--vg-row-border` `--vg-header-border` `--vg-outer-border` `--vg-select-column-width` `--vg-expander-size` |
1968
+ | Sub-grid | `--vg-subgrid-bg` `--vg-subgrid-indent` `--vg-subgrid-border` `--vg-subgrid-radius` |
1969
+ | Elevation | `--vg-shadow-pinned` `--vg-shadow-popover` `--vg-z-header` `--vg-z-pinned` `--vg-z-pinned-header` `--vg-transition` `--vg-menu-gap` |
1970
+ | Change highlight | `--vg-flash-color` `--vg-flash-up` `--vg-flash-down` `--vg-flash-duration` |
1971
+
1972
+ Motion stays on the compositor (`transform`, `opacity`) wherever layout would otherwise animate.
1973
+ Row highlights (hover, selection) appear at once and fade out over `--vg-transition`, so the grid
1974
+ responds the moment the pointer arrives.
1975
+
1976
+ Colours use `light-dark()`: set `color-scheme: light dark` on `html` to follow the OS, or
1977
+ `color-scheme: dark` to force dark. Stable class names (`.vg-header-cell`, `.vg-cell`, `.vg-row`,
1978
+ `.vg-subgrid`, `.vg-pin-left`, …) and the `ui` prop are there for anything tokens don't cover.
1979
+
1980
+ ### Bring your own theme
1981
+
1982
+ The tokens above come from `theme.css`, which is optional. Import `base.css` instead and the grid
1983
+ keeps its structure (columns, sub-grid alignment, sticky header and pins, tree indent, anchored
1984
+ menus and popovers) with none of the default look. Then style the classes yourself:
1985
+
1986
+ ```ts
1987
+ import '@nocopypaste/vue-grid/base.css'
1988
+ import './my-grid-theme.css'
1989
+ ```
1990
+
1991
+ ```css
1992
+ /* my-grid-theme.css — unlayered, or in your own layer after `vue-grid` */
1993
+ .vg-viewport { border: 1px solid #ddd; }
1994
+ .vg-header-cell { padding: 0.5rem 0.75rem; background: #fafafa; font-weight: 600; }
1995
+ .vg-cell { padding: 0.5rem 0.75rem; border-top: 1px solid #eee; }
1996
+ .vg-row:hover > .vg-cell { background: #f5f5f5; }
1997
+ ```
1998
+
1999
+ Base only gives sticky header and pinned cells the system `Canvas` background, so content doesn't
2000
+ show through them; everything else (colours, spacing, borders, fonts, focus rings, animation) is
2001
+ yours. The structural tokens `--vg-select-column-width`, `--vg-expander-size`,
2002
+ `--vg-subgrid-indent`, `--vg-z-*` and `--vg-menu-gap` live in `base.css` and can be overridden
2003
+ the same way. `renderers.css` reads the theme's colour tokens; define them (or skip the file) when
2004
+ you drop `theme.css`.
2005
+
2006
+ ## For coding agents
2007
+
2008
+ [`AGENTS.md`](AGENTS.md) is the short guide for AI coding agents (rules, which feature and
2009
+ renderer for what, recipes, pitfalls); [`llms.txt`](llms.txt) and `llms-full.txt` follow the
2010
+ llms.txt convention. The API reference is generated from the sources into
2011
+ [`agent/api.md`](agent/api.md) and `agent/api.json`, with a
2012
+ [JSON Schema](agent/grid-config.schema.json) of a grid config. To check a config:
2013
+
2014
+ ```ts
2015
+ import { validateGridConfig } from '@nocopypaste/vue-grid/agent'
2016
+
2017
+ const { ok, diagnostics } = validateGridConfig({
2018
+ rowKey: 'id',
2019
+ features: ['sortingFeature'], // export names (or the feature objects); 'allFeatures' for all
2020
+ renderers: [], // registered renderer names / definitions
2021
+ columns: [{ key: 'total', renderer: 'currency', sortable: true, widht: '8rem' }],
2022
+ })
2023
+ // error columns[0].widht Columns have no option `widht`. Did you mean `width`?
2024
+ // warning columns[0].renderer Renderer name `currency` isn't registered … pass `renderer: currencyRenderer`
2025
+ // warning props.sortMode Sortable columns, but sorting is controlled … add `sort-mode="client"`
2026
+ ```
2027
+
2028
+ `@nocopypaste/vue-grid/agent` is a separate entry: apps that don't import it never bundle it. The
2029
+ [`@nocopypaste/vue-grid-mcp`](../vue-grid-mcp) MCP server serves the same to agents as tools, and the
2030
+ [Claude Code plugin](../../plugins/vue-grid) adds a skill with the full workflow.
2031
+
2032
+ ## Browser support
2033
+
2034
+ Evergreen browsers: CSS `subgrid`, `light-dark()`, `@layer`, the Popover API and `<dialog>`
2035
+ (Chrome/Edge 123+, Firefox 125+, Safari 17.5+).
2036
+
2037
+ **CSS first, JS only as a fallback.** Everything the browser can do in CSS / HTML is done there; a
2038
+ small JS fallback runs only when a feature check (`CSS.supports`) says the browser can't:
2039
+
2040
+ | Behaviour | Done with | JS fallback when unsupported |
2041
+ |---|---|---|
2042
+ | Menu / popover placement, flipping, following the anchor on scroll | Popover API + CSS anchor positioning | measured placement, re-run on scroll / resize |
2043
+ | Hiding a popover once its anchor scrolls out of view | `position-visibility: anchor-visible` | IntersectionObserver (e.g. Firefox 159) |
2044
+ | Sticky offsets of pinned columns | `calc()` sums of the declared widths | ResizeObserver, only for content-sized pinned columns |
2045
+ | Which pinned column gets the edge shadow | `:has()` / sibling selectors | a class |
2046
+ | Shadow only while content is scrolled under pinned columns | `@container scroll-state(scrollable: …)` | scroll listener sets `data-vg-scrollable` |
2047
+ | Readable text on data-coloured chips | `contrast-color()` / relative colours | computed black / white |
2048
+ | Expand / collapse (JSON tree, “More info”, list “+N more”) | native `<details>` / `<summary>` | — |
2049
+ | Closing the JSON dialog on a backdrop click | `<dialog closedby="any">` | backdrop click handler |
2050
+
2051
+ What stays in JS is what CSS can't express: data (sorting, selection, expansion state), keyboard
2052
+ navigation, column drag, virtual scrolling and lazy loading.