Interface WebviewPanel

A panel that contains a webview.

interface WebviewPanel {
    active: boolean;
    iconPath?: Uri | {
        dark: Uri;
        light: Uri;
    };
    onDidChangeViewState: Event<WebviewPanelOnDidChangeViewStateEvent>;
    onDidDispose: Event<void>;
    options: WebviewPanelOptions;
    showOptions?: WebviewPanelShowOptions;
    title: string;
    viewColumn?: ViewColumn;
    viewType: string;
    visible: boolean;
    webview: Webview;
    dispose(): void;
    reveal(area?, viewColumn?, preserveFocus?): void;
    reveal(viewColumn?, preserveFocus?): void;
}

Properties

active: boolean

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

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

Icon for the panel shown in UI.

Type declaration

Fired when the panel's view state changes.

onDidDispose: Event<void>

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.

Content settings for the webview panel.

Settings to determine where webview panel will be reside

title: string

Title of the panel shown in UI.

viewColumn?: ViewColumn

Editor position of the panel. This property is only set if the webview is in one of the editor view columns.

viewType: string

Identifies the type of the webview panel, such as 'markdown.preview'.

visible: boolean

Whether the panel is visible.

webview: Webview

Webview belonging to the panel.

Methods

  • 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

  • Show the webview panel according to a given options.

    A webview panel may only show in a single column at a time. If it is already showing, this method moves it to a new column.

    Parameters

    • Optional area: WebviewPanelTargetArea

      target area where webview panel will be resided. Shows in the 'WebviewPanelTargetArea.Main' area if undefined.

    • Optional viewColumn: ViewColumn

      View column to show the panel in. Shows in the current viewColumn if undefined.

    • Optional preserveFocus: boolean

      When true, the webview will not take focus.

    Returns void

  • Show the webview panel in a given column.

    A webview panel may only show in a single column at a time. If it is already showing, this method moves it to a new column.

    Parameters

    • Optional viewColumn: ViewColumn

      View column to show the panel in. Shows in the current viewColumn if undefined.

    • Optional preserveFocus: boolean

      When true, the webview will not take focus.

    Returns void