Skip to main content

Interface: WebviewPanel

Defined in: packages/extension-api/src/extension-api.d.ts:2073

A panel that contains a webview.

Properties​

active​

readonly active: boolean

Defined in: packages/extension-api/src/extension-api.d.ts:2108

Whether the panel is active (focused by the user).


iconPath?​

optional iconPath?: Uri | { dark: Uri; light: Uri; }

Defined in: packages/extension-api/src/extension-api.d.ts:2087

Icon for the panel shown in UI.

Union Members​

Uri


Type Literal​

{ dark: Uri; light: Uri; }

dark​

readonly dark: Uri

The icon path for the dark theme.

light​

readonly light: Uri

The icon path for the light theme.


onDidChangeViewState​

readonly onDidChangeViewState: Event<WebviewPanelOnDidChangeViewStateEvent>

Defined in: packages/extension-api/src/extension-api.d.ts:2118

Fired when the panel's view state changes.


onDidDispose​

readonly onDidDispose: Event<void>

Defined in: packages/extension-api/src/extension-api.d.ts:2128

Fired when the panel is disposed.

This may be because the user closed the panel or because .dispose() was called on it.

Trying to use the panel after it has been disposed throws an exception.


title​

title: string

Defined in: packages/extension-api/src/extension-api.d.ts:2082

Title of the panel shown in UI.


viewType​

readonly viewType: string

Defined in: packages/extension-api/src/extension-api.d.ts:2077

Identifies the type of the webview panel.


visible​

readonly visible: boolean

Defined in: packages/extension-api/src/extension-api.d.ts:2113

Whether the panel is visible.


webview​

readonly webview: Webview

Defined in: packages/extension-api/src/extension-api.d.ts:2103

Webview belonging to the panel.

Methods​

dispose()​

dispose(): void

Defined in: packages/extension-api/src/extension-api.d.ts:2143

Dispose of the webview panel.

This closes the panel if it showing and disposes of the resources owned by the webview. Webview panels are also disposed when the user closes the webview panel. Both cases fire the onDispose event.

Returns​

void


reveal()​

reveal(preserveFocus?): void

Defined in: packages/extension-api/src/extension-api.d.ts:2134

Show the webview panel.

Parameters​

preserveFocus?​

boolean

When true, the webview will not take focus.

Returns​

void