Get the latest insights, best practices, and tips from power users

Hygraph
Docs

Common props for all elements

export interface ExtensionPropsBase {
context: {
project: {
id: string;
name: string;
mgmtApi: string;
};
environment: {
id: string;
name: string;
endpoint: string;
authToken: string;
};
};
// Opens a separate dialog where you can load data from an external source or create your own UI
// 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>)>;
// Function to show Hygraph native toast.
// See `ShowToast` in "additional types"
showToast: ShowToast;
// Hygraph internal navigation (without page refresh)
// Function to replace the current entry on the history stack inside Hygraph (internal - path included)
historyReplace: (url: string | (currentUrl: string) => string) => Promise<void>;
// Function to redirect inside Hygraph (internal - path included)
historyPush: (url: string | (currentUrl: string) => string) => Promise<void>;
// Redirect the Hygraph app (full redirect to any URL)
redirectParent: (location: string | Location) => Promise<void>;
}