diff --git a/packages/sandbox/src/EmbeddedSandbox.ts b/packages/sandbox/src/EmbeddedSandbox.ts index 229fa57..ecfaae2 100644 --- a/packages/sandbox/src/EmbeddedSandbox.ts +++ b/packages/sandbox/src/EmbeddedSandbox.ts @@ -6,6 +6,12 @@ import packageJSON from '../package.json'; import type { JSONObject } from './helpers/types'; type InitialState = { + /** + * optional. Set initial display options for sandbox + */ + displayOptions?: { + docsPanelState?: 'open' | 'closed'; // default to 'open', + }; /** * optional. Set headers for every operation a user triggers from this Sandbox. * Users can check and uncheck these headers, but not edit them. @@ -139,7 +145,8 @@ export class EmbeddedSandbox { let element: HTMLElement | null; const { target, runTelemetry } = this.options; - const { includeCookies, sharedHeaders } = this.options.initialState || {}; + const { includeCookies, sharedHeaders, displayOptions } = + this.options.initialState || {}; const queryParams = { runtime: this.options.runtime, @@ -185,6 +192,7 @@ export class EmbeddedSandbox { shouldDefaultAutoupdateSchema: this.options.initialState?.pollForSchemaUpdates ?? true, endpointIsEditable: this.options.endpointIsEditable, + docsPanelState: displayOptions?.docsPanelState ?? 'open', }; const queryString = Object.entries(queryParams)