Embedded Host Actions
Trigger workspace-native drawers from apps running inside the embedded iframe runtime
Apps running inside the embedded workspace runtime can ask the host app to open native drawers on top of the iframe.
Import these helpers from @andibase/hooks inside your app code:
import {
openDataRecordForm,
openInlineAgentChat,
useAndibaseRefreshOnReturn,
} from "@andibase/hooks";Open the record form drawer
Use openDataRecordForm() to open the schema-driven record form drawer for a data definition.
Create mode:
openDataRecordForm({
definitionHandle: "customer",
defaultValues: {
firstName: "Ada",
active: true,
},
});Edit mode:
openDataRecordForm({
mode: "edit",
definitionHandle: "customer",
recordId: "rec_123",
defaultValues: {
firstName: "Ada",
active: true,
},
});Notes:
definitionHandleis always required.- Edit mode requires
recordId. defaultValuesis optional in both modes.- The drawer is opened by the host page, not by the iframe itself.
- If the app should reload data after the drawer closes, prefer
useAndibaseRefreshOnReturn(loadData)over a rawwindow.focuslistener.
Open the inline agent chat drawer
Use openInlineAgentChat() to open the full-screen inline agent chat drawer with the same host chat UI used elsewhere in the product.
openInlineAgentChat({
agentHandle: "support-assistant",
});Optionally open a specific chat id:
openInlineAgentChat({
agentHandle: "support-assistant",
chatId: "chat_existing_01",
});Notes:
- The active chat id is stored in host memory, not in the URL.
- The drawer includes its own close button.
- History and “new chat” actions stay inside the drawer instead of navigating the iframe.
- If chat actions should trigger a data refresh when the user returns to the app, use
useAndibaseRefreshOnReturn()instead of unconditional iframe focus handlers.
Availability
These helpers are available in the embedded runtime import map alongside @andibase/ui.
- See Apps for the embedded runtime contract.
- See Get started (for AI Agents) for the runtime summary.