feat(core): add plugin-contributed context menus to Table
What
Adds a plugin-contributed right-click context-menu system to Table. Right-clicking a column header shows a menu of actions aggregated from every enabled plugin (instead of the browser's generic menu) — e.g. with useTableSortable enabled, right-clicking a sortable header offers Sort ascending / Sort descending / Clear sort.
Design
Plugins contribute actions rather than each rendering their own menu — the table aggregates actions from all plugins into one menu per header, avoiding nested/clobbered menus.
- New
TableContextActiontype and two optional, backward-compatibleTablePluginmethods:getHeaderContextActions(column, columnIndex)andgetRowContextActions(item, rowIndex). tableContextMenu.tsx:collectHeaderContextActions/collectRowContextActions(aggregate across plugins) +wrapInTableContextMenu(maps actions →ContextMenuoptions, dividers between groups, checkmark for the active item,hasAutoFocus={false}so right-click doesn't pre-highlight). When no plugin contributes actions the element is untouched and the native browser menu passes through.BaseTablecollects + wraps at the header render path;useBaseTablePluginsregisters the two new plugin keys.- First contributor:
useTableSortableadds asc/desc/clear (adapted to Astryx's array sort-state).
Other plugins opt in by implementing the same two methods — no core changes needed.
Scope note
Header menus only in this PR. The interface includes getRowContextActions and the row collector is built/exported, but row-menu rendering into <tr> is a follow-up: Astryx's ContextMenu wraps its trigger in a <div>, invalid between <tbody> and <tr>. Needs an asChild/Slot option on ContextMenu (or an onContextMenu-on-<tr> approach). Header menus — the sortable use case — work fully.
Demo
Surfaces on the existing Core → TableSortable stories (no new stories) — right-click any sortable column header.
Validation
pnpm -F @astryxdesign/core build✅ (incl. tsc),eslint✅- New
tableContextMenu.test.tsx(6 tests: aggregation, header render, no-op passthrough, sortable asc/desc/clear). Full Table suite: 318 pass. - Changeset included (
[feat]).
@humbertovirtudes is attempting to deploy a commit to the Meta Open Source Team on Vercel.
A member of the Team first needs to authorize it.
https://github.com/user-attachments/assets/ac663193-b67d-4a69-891e-fb84b2163aba
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Actions | Updated (UTC) |
|---|---|---|---|
| astryx | Preview, Comment | Jun 30, 2026 11:35pm |