1

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

pikk
  • 837
  • 5
  • 21
  • 38

3 Answers3

3

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>
  );
};
JD Huntington
  • 348
  • 1
  • 5
0

layerProps is an optional props to pass to the Layer component hosting the panel.Do you have a Layer Component?


Also, styles can have a className as properties, you may try to give the component a customised name and adapt the css.

tcf01
  • 1,699
  • 1
  • 9
  • 24
  • even the className , how am i going to pass it in order to be used as a prop. overlayProps={{className:"testClassName"}} is not working either – pikk Jun 05 '20 at 15:53
-1

i guess you can check out the "Panel - custom navigation" provided in your link.

it has something like below to override searchbox. I think Panel should be the same since it also accepts a similar styles prop.

const searchboxStyles = { root: { margin: '5px', height: 'auto', width: '100%' } };
  <SearchBox
        placeholder="Search here..."
        styles={searchboxStyles}
        ariaLabel="Sample search box. Does not actually search anything."
      />
weiklr
  • 159
  • 1
  • 7