跳到主要内容

TFrameConfig

The main configuration object for initializing an ONLYOFFICE Apps frame. Passed to SDKInstance.initFrame or any SDK.init* wrapper.

Only frameId, mode, and src are required — all other fields have defaults from defaultConfig. The SDK.init* wrappers set mode themselves and take a TInitConfig, where only frameId and src are required.

type TFrameConfig = object;

Example​

const config: TFrameConfig = {
frameId: "ds-frame",
src: "https://portal.example.com",
mode: "manager",
width: "100%",
height: "700px",
theme: "Dark",
};
sdk.init(config);

Properties​

PropertyTypeDescription
acceptButtonLabelstringCustom label for the selector "Accept" button.
acceptExtensionsstringAccepted file extensions for SDKMode.Uploader (e.g. ".pdf,.docx").
accessTokenstringStatic OAuth access token (convenience). The SDK wraps it as getToken: () => accessToken. The SDK cannot refresh it — prefer TFrameConfig.getToken for anything longer than the token TTL.
agentIdstring | numberAI agent room ID. Optional in SDKMode.Chat: when set, the chat is bound to that agent; when omitted, the chat is bound to the current user. The chat renders its composer only for a signed-in user who is not a guest; otherwise the page shows a no-access state and fires TFrameEvents.onNoAccess. AI disabled on the portal also hides the composer, without the event.
buttonColorstringHEX color for the selector accept button. Default: "#5299E0". Deprecated ONLYOFFICE Apps 4.0 does not read it; the selector uses the portal theme.
cancelButtonLabelstringCustom label for the selector "Cancel" button.
checkCSPbooleanValidate the host against the portal's CSP allowlist before loading the iframe (host name and port only). false skips the request to CSPApiUrl; the browser still enforces the portal's frame-ancestors header. Default: true.
customActionsTCustomActionsConfigCustom items for the context menus and the create menu in SDKMode.Manager, SDKMode.Personal and SDKMode.Forms, applied when the frame loads. Clicks fire TFrameEvents.onCustomAction. Replace them later with SDKInstance.setCustomActions. Not available through the script-tag parameters. Unset by default.
destinationTFormsSectionInitial section to display in SDKMode.Forms. Determines which page loads when the frame is created, avoiding an extra SDKInstance.navigateSection call. See TFormsSection. Default: "my-forms".
destroyTextstringPlain text shown in the placeholder div after SDKInstance.destroyFrame. Markup is not rendered. Default: "".
disableActionButtonbooleanHide the "Actions" button in SDKMode.Manager. Default: false.
downloadToEventbooleanRedirect download links to TFrameEvents.onDownload instead of downloading directly, in SDKMode.Manager, SDKMode.PublicRoom and SDKMode.Personal. Default: false.
editorCustomizationTEditorCustomizationEditor UI customization. See TEditorCustomization. Default: {}.
editorGoBackboolean | "event"The "Open file location" button of the editor. true = the button opens the file's folder; "event" = the button fires TFrameEvents.onEditorCloseCallback instead (set automatically when the handler is registered); false = no button. Default: true.
editorTypeTEditorTypeEditor UI layout sent to the backend. See EditorType. Default: "desktop".
emplTypestringEmployee type for the sign-up through TFrameConfig.providerName in SDKMode.Forms, SDKMode.Chat and SDKMode.Personal.
entityIdstring | numberID of the room or folder the chat is opened from — the user's current location. Optional in SDKMode.Chat; undefined by default. The AI receives it as workspace context and by default scopes tool calls (searches, listings, folder contents) to this location. The current user must have access to the entity, otherwise chat requests are rejected.
eventsTFrameEventsEvent handlers. See TFrameEvents.
extensionsTextstringFile extensions hint text in SDKMode.Uploader.
fileIdstring | numberFile ID to attach to the chat composer on init. Optional in SDKMode.Chat.
filterTFrameFilterFilter/sort/pagination for the file list. See TFrameFilter.
filterParamstringFile type filter for SDKMode.FileSelector. "ALL" = no restriction. Default: "ALL".
frameIdstringRequired. Unique frame identifier. Used as the DOM id and the postMessage routing key. Default: "ds-frame".
getToken() => string | Promise<string>OAuth access-token provider. Setting it (or TFrameConfig.accessToken) switches the frame into OAuth mode: the frame authorizes API calls with Authorization: Bearer <token> instead of the session cookie, so no cookie is set and the portal session cannot outlive a sign-out in the host application. The host backend runs the authorization-code and refresh-token exchange and returns a fresh access token; client_secret and refresh tokens never reach the browser. The SDK calls it at start, after a 401 and, for a JWT or with TFrameConfig.tokenExpiresAt, one minute before expiry. SDKInstance.login and SDKInstance.logout reject with SDKErrorCode.ModeMismatch in OAuth mode, and token failures surface through TFrameEvents.onAuthError. Default: undefined.
headerHeightnumberHeight (in px) of the header component inside the iframe. When unset, ONLYOFFICE Apps uses its own built-in header height; supply this only to override it so the embedded UI matches the host application's chrome. Currently honored in SDKMode.Forms, SDKMode.Personal and SDKMode.Chat.
headerOffsetnumberInline-start padding (in px) added to header rows so host overlays on the left edge (e.g. Nextcloud floating menu) don't cover the burger / breadcrumbs / chat-header controls. The outer iframe container is not shifted — only the elements inside the header move to the right (or to the left in RTL). Currently honored in SDKMode.Forms, SDKMode.Personal and SDKMode.Chat. Default: 0.
heightstringIframe height. CSS value: "100%", "600px", etc. Default: "100%".
idstring | number | nullEntity ID: the file in SDKMode.Editor and SDKMode.Viewer, the target folder in SDKMode.Uploader, the room in SDKMode.PublicRoom, the folder to open in SDKMode.Personal, the form filling room in SDKMode.Forms (optional there: the room from the portal's Forms settings is used when unset). Default: null.
infoPanelVisiblebooleanShow info panel toggle in SDKMode.Manager. Default: true.
initboolean | nullReserved. Controls whether the frame should auto-initialize.
integrationUrlstringURL of the integration page. Deprecated ONLYOFFICE Apps 4.0 does not read it: the frame returns the user to its own origin after external navigation (e.g. billing).
inviteKeystringInvitation key for the sign-up through TFrameConfig.providerName in SDKMode.Forms, SDKMode.Chat and SDKMode.Personal.
isFolderUploadbooleanAllow folder upload in SDKMode.Uploader.
isMultipleUploadbooleanAllow multiple file upload in SDKMode.Uploader.
libraryIdstringLibrary ID for SDKMode.Forms to display only items from a forms library.
linkMainTextstringLink main text in SDKMode.Uploader.
localestring | nullUI locale as a BCP 47 code (e.g. "en-US"). Applies to the frame only. null = the language configured on the portal or in the signed-in user's profile. Default: null.
maxPerUploadSizestringMax single file/folder size in SDKMode.Uploader.
maxTotalUploadSizestringMax total upload size in SDKMode.Uploader.
methodTimeoutnumberTimeout in milliseconds for method calls to the iframe. If the iframe does not respond within this time, the call rejects with SDKErrorCode.Timeout and TFrameEvents.onAppError fires. Does not apply to SDKInstance.upload, which has its own 120-second transfer timeout. Default: 30000 (30 seconds).
modeTFrameModeRequired. SDK mode. Determines UI and available methods. See SDKMode.
namestringIframe name attribute prefix. Default: FRAME_NAME.
noLoaderbooleanSkip the loading spinner. true = iframe appears immediately. Forced per mode: SDKMode.Manager and SDKMode.System always show the spinner (false), SDKMode.Forms and SDKMode.Personal never do (true). Default: true.
openEditorInSameTabbooleanWhere a file opens from the list in SDKMode.Forms and SDKMode.Personal when TFrameEvents.onEditorOpen is not set: true navigates the host page to the editor, false opens a new tab. Unset = the portal's "Open in the same tab" setting.
personalDestinationTPersonalSectionInitial section to display in SDKMode.Personal. Determines which page loads when the frame is created, avoiding an extra SDKInstance.navigateSection call. See TPersonalSection. Default: "my-documents".
providerNamestringThird-party sign-in provider (e.g. "nextcloud") for automatic sign-in and sign-up in SDKMode.Forms, SDKMode.Chat and SDKMode.Personal: a visitor without a portal session is sent through that provider and returned to the frame. A cookie-based flow, unrelated to OAuth mode (TFrameConfig.getToken).
requestTokenstring | nullShare key of an external link: the room link in SDKMode.PublicRoom and SDKMode.Manager, the file link in SDKMode.Editor and SDKMode.Viewer. Ignored by other modes. Obtain it from TRequestTokenInfo.requestToken. Default: null.
roomTypestringRoom type filter for SDKMode.RoomSelector: a RoomType API value as a string ("5" for custom rooms).
rootPathstringBase navigation path for SDKMode.Manager. Default: "/rooms/shared/".
secondaryTextstringSecondary description text in SDKMode.Uploader.
selectorTypeTSelectorTypeContent filter for selector modes. See SelectorFilterType. Default: "all".
showFilterbooleanShow filter toolbar in SDKMode.Manager, with the create menu that holds TCustomActionsConfig.createMenu items. Default: false.
showHeaderbooleanShow the header bar in the mobile view of SDKMode.Manager. Not read by other modes. Default: false.
showHeaderBannerTBannerDisplayingHeader banner visibility in SDKMode.Manager. See HeaderBannerDisplaying. Default: "none".
showMenubooleanShow the left navigation menu in SDKMode.Manager and SDKMode.Forms. Forms reads it when the frame loads, so a later SDKInstance.setConfig can hide the menu but not show it. SDKMode.Personal has no navigation menu: switch its sections with SDKInstance.navigateSection. Default: false.
showSelectorCancelbooleanShow "Cancel" button in selector modes. Default: false.
showSelectorHeaderbooleanShow header bar in selector modes. Default: false.
showSettingsbooleanShow "Manage displayed columns" button in table view. Default: false.
showSignOutbooleanShow "Sign out" button. Default: true.
showTitlebooleanShow current section/room/folder title in SDKMode.Manager. Default: true.
srcstringRequired. ONLYOFFICE Apps portal URL. Used as the iframe src origin.
stylesUrlstringAbsolute http/https URL of a stylesheet applied inside the frame, in every mode. A relative or non-HTTP URL is dropped silently. The portal loads it cross-origin, so the serving host must allow it with CORS.
themeTThemeColor theme. See Theme. Default: "System".
threadIdstringThread ID to resume. Optional in SDKMode.Chat.
tokenExpiresAtnumberExpiry of the first access token as epoch milliseconds, for the proactive refresh in OAuth mode. When omitted, the expiry is read from the token's JWT exp claim. Tokens obtained by a refresh always use their own exp claim; an opaque token without one is refreshed on demand only, after a 401.
typeTEditorTypePlatform layout. Affects iframe CSS (e.g. "mobile" sets position: fixed). See EditorType. Default: "desktop".
uidstringUser identifier passed to the sign-in through TFrameConfig.providerName in SDKMode.Forms, SDKMode.Chat and SDKMode.Personal.
viewAsTManagerViewModeItem layout in SDKMode.Manager. See ManagerViewMode. Default: "row". Deprecated ONLYOFFICE Apps 4.0 does not read it: the layout is the one the user last chose. Call SDKInstance.setListView after TFrameEvents.onAppReady instead.
viewTableColumnsstringVisible table columns in SDKMode.Manager, comma-separated. Applies in the table layout only (SDKInstance.setListView); a column set the user saved in the browser takes precedence. Default: "Index,Name,Size,Type,Tags".
waitingbooleanDelay iframe append. When true, the iframe is not rendered until SDKInstance.setConfig is called with reload = true (without reload the call rejects with SDKErrorCode.Disconnected). SDKMode.System ignores the flag. Default: false.
widthstringIframe width. CSS value: "100%", "800px", etc. Default: "100%".
withBreadCrumbsbooleanShow breadcrumb navigation in selector modes. Default: true.
withSearchbooleanShow search bar in selector modes. Default: true.
withSubtitlebooleanShow the subtitle with the folder description in SDKMode.FileSelector. Not passed to SDKMode.RoomSelector. Default: true.