reactjsoffice-ui-fabricoffice-ui-fabric-reactfluent-ui

how to pass the overlayProps into Panel


How can I pass the styles overlayProps into the Panel component as it is stated in https://developer.microsoft.com/en-us/fluentui#/controls/web/panel

I tried:

<Panel
    overlayProps={{styles:{backgroundColor:'red'}}}
/>

But does not seems to work


Solution

  • The only thing missing from the original source is root, which is the target element in the overlay.

    This snippet (full example) shows a Panel with a red overlay. (full example)

    const PanelBasicExample: React.FunctionComponent = () => {
      return (
        <div>
          <Panel
            headerText="Sample panel"
            isOpen={true}
            overlayProps={{ className: "foo", styles: { root: { backgroundColor: "red" }}}}
          >
            <p>Content goes here.</p>
          </Panel>
        </div>
      );
    };