Setting the file. One moment.
Subchapter 2.13
references/auto-patterns-dashboard/custom-actions-override.mdMarkdown2 KBView on GitHub
REQUIRED: After creating action files, you MUST update page.tsx to register them.
interface ResolvedAction {
label: string;
icon?: React.ReactElement;
onClick: () => void | Promise<void>;
disabled?: boolean;
hidden?: boolean;
}
// Action Resolver Signature
type CustomActionResolver = (params: {
item: any;
selectedItems?: any[];
}) => ResolvedAction;{
"actions": [
{
"type": "custom",
"id": "myAction" // Matches override key
}
]
}type is "custom" THEN id MUST match key in actions override.onClick SHOULD return a Promise.selectedItems.components/actions/ folder..tsx extension if the file contains JSX (icons, React elements). Use .ts only for pure logic files.useActions hook from components/actions/index.tsx.ResolvedAction object.try/catch or errorHandler for Wix APIs).// components/actions/myAction.tsx (use .tsx when file contains JSX like icons)
export const myAction = ({ item }) => ({
label: 'Approve',
icon: <Check />,
onClick: async () => {
await approveItem(item.id);
}
});
// components/actions/index.tsx
import { myAction } from './myAction';
export const useActions = () => ({ myAction });CRITICAL: PRESERVE EXISTING OVERRIDES - Do NOT remove existing overrides. ADD this new one alongside them.
// 1. Add import (keep all existing imports)
import { useActions } from './components/actions';
// 2. Add hook call (keep all existing hook calls)
const actions = useActions();
// 3. Add actions to PatternsWizardOverridesProvider value (keep ALL existing overrides)