PlaceholderContent class

Represents custom content that is rendered inside a placeholder on a SharePoint page.

Remarks

This object is returned by PlaceholderProvider.tryCreateContent(). It provides access to a Document Object Model (DOM) element where the owner can render its custom content.

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the PlaceholderContent class.

Properties

domElement

The Document Object Model (DOM) element where the owner should render its custom content.

isDisposed
isVisible

Return true if this PlacholderContent object is visible. If you create a placeholder and the host page isn't displaying it, this will return false.

name

Identifies the placeholder that this content was added to.

Methods

dispose()

Disposes the PlaceholderContent object and removes its attached DOM element from the page.

Property Details

domElement

The Document Object Model (DOM) element where the owner should render its custom content.

get domElement(): HTMLDivElement;

Property Value

HTMLDivElement

Remarks

If the caller needs to be notified when the DOM element is disposed, use the IPlaceholderCreateContentOptions.onDispose callback.

isDisposed

get isDisposed(): boolean;

Property Value

boolean

isVisible

Return true if this PlacholderContent object is visible. If you create a placeholder and the host page isn't displaying it, this will return false.

get isVisible(): boolean;

Property Value

boolean

name

Identifies the placeholder that this content was added to.

get name(): PlaceholderName;

Property Value

Remarks

Example: PlaceholderName.Top

Method Details

dispose()

Disposes the PlaceholderContent object and removes its attached DOM element from the page.

dispose(): void;

Returns

void

Remarks

This method can be called to immediately dispose the attached DOM element. Otherwise, it will be disposed by the application when the containing placeholder is disposed. Calling dispose() invokes the IPlaceholderCreateContentOptions.onDispose callback, removes the associated DOM element from the page, and disposes the PlaceholderContent object.