I'm developing a SharePoint Framework (SPFx) list Extension (Command Set). After clicking on my custom action/Command I would very much like to open a side panel like in this nice demo. I haven't found any "official side panel" component, is there any?
To use the demo code linked above, I need to access some DOM element or a page placeholder. In the demo, which is a web part, they can access the DOM element.
export default class SidePanelWebPart extends
BaseClientSideWebPart<ISidePanelWebPartProps> {
public render(): void {
const element: React.ReactElement<ISidePanelProps > = React.createElement(
SidePanel,
{
panelPosition: this.properties.panelPosition
}
);
ReactDom.render(element, this.domElement);
}
However my Command Set list extension is a BaseListViewCommandSet, and I cannot find any domElement or any other element reference in this, this.context or this.context.pageContext.
Following this Microsoft guide it should be possible to get a reference to a page holder via the context.placeholderProvider property.
this.context.placeholderProvider.tryCreateContent( PlaceholderName.Bottom)
Again my Command Set list extension is a BaseListViewCommandSet, and this.context does not contain a property placeholderProvider, neither does this.context.pageContext.
So I've just reverted to getting any element via plain javascript, e.g. via document.body:
ReactDom.render(element, document.body);
And it seems to work. But it feels hackish to open the side panel in this manner. But this is the best I've found so far. Any suggestions of improvements?
Edit 2018-03-27 To further explain. The "side panel" experience should be the same as when you use the "Copy to" and "Move to" custom actions: