Forum Discussion

MichelLAPLANE's avatar
Jul 03, 2019

Screen resolution using SPFX React

Hi All I want to set the width and height of my Visio SPFx WebPart regarding the resolution of the screen. For now I use some properties but they are set in the Property Tab so fixed when the WebPart is published. In Large Screen the WebPart displays very small.

 

Is there a way to get the resolution of the screen so I can change the Width and Height accordingly with the screen on which the WebPart is displayed  when in the DidMount method.

 

Regards.

 

1 Reply

  • Toby Statham's avatar
    Toby Statham
    Brass Contributor

    MichelLAPLANE Have you had a look at the Layout styles in Office Fabric UI - https://developer.microsoft.com/en-us/fabric#/styles/web/layout

    You could have different sizes set for the different widths

     

    Or the ResizeGroup react control might be of use https://developer.microsoft.com/en-us/fabric#/controls/web/resizegroup

     

     

Resources