Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

sp webpart base.webpartcontext

John Nguyen edited this page Apr 22, 2021 · 2 revisions

Home > @microsoft/sp-webpart-base > WebPartContext

WebPartContext class

Web part context object. This object contains the contextual services available to a web part. e.g. a contextual instance to the http client.

Signature:

export default class WebPartContext extends BaseWebPartContext

Extends: BaseWebPartContext

Remarks

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

Properties

Property Modifiers Type Description
domElement HTMLElement Reference to the DOM element that hosts this client-side component.
microsoftTeams typeof microsoftTeams | undefined Contextual information about the current Microsoft Teams tab. This object will only be defined if a component is being hosted in Microsoft Teams.
sdks ISDKs Conditional set of SDKs provided by SPFx dependent on the environment.
statusRenderer IClientSideWebPartStatusRenderer Web part status renderer.
widthCacheKey string | undefined This functions returns a key generated by web parts display mode, layout index, and section factor. It will return undefined if sectionFactor or display mode is undefined, else return the cache key.
Clone this wiki locally