usePluginContext
usePluginContext<
TPluginId>():PluginContextValue<TPluginIdextendsnever?PluginArgsRegistry[TPluginId<TPluginId>] :unknown>
Defined in: Context.tsx:303
Hook to access table context from within a plugin component.
Note: data, selectedRows, and table are typed as unknown because
plugins are defined generically and cannot know the specific row type at
definition time. Cast as needed in your plugin implementation.
Type Parameters
Section titled “Type Parameters”TPluginId
Section titled “TPluginId”TPluginId extends string & object = string
The plugin ID for type-safe openArgs (optional)
Returns
Section titled “Returns”PluginContextValue<TPluginId extends never ? PluginArgsRegistry[TPluginId<TPluginId>] : unknown>
Examples
Section titled “Examples”function MyPluginComponent() { const { table, data, selectedRows, useEvent } = usePluginContext();
useEvent("selection-change", (rows) => { console.log("Selection changed:", rows); });
return <div>Total rows: {data.length}</div>;}// First, register the plugin args type:declare module "@izumisy/seizen-table/plugin" { interface PluginArgsRegistry { "row-detail": { row: Person }; }}
// Then use with plugin ID for type-safe openArgs:function RowDetailPanel() { const { openArgs } = usePluginContext<"row-detail">(); // openArgs is typed as { row: Person } | undefined const row = openArgs?.row;}