We just launched our new Hygraph Studio in beta. Learn more

Hygraph
Docs

Hooks API reference

Common props for all extensions

export interface ExtensionPropsBase {
context: {
project: {
id: string;
name: string;
mgmtApi: string;
mgmtToken: string;
};
environment: {
id: string;
name: string;
endpoint: string;
authToken: string;
};
};
// see `OpenDialog` in "additional types"
openDialog: OpenDialog;
// open the asset picker (see the Asset type in your Content Api)
openAssetPicker: () => Promise<null | (Asset & Record<string, unknown>)>;
// see `ShowToast` in "additional types"
showToast: ShowToast;
// Hygraph internal navigation (without page refresh)
historyReplace: (url: string | (currentUrl: string) => string) => Promise<void>;
historyPush: (url: string | (currentUrl: string) => string) => Promise<void>;
// Redirect the Hygraph app (full redirect to any URL)
redirectParent: (location: string | Location) => Promise<void>;
}