node.jselectronatom-editor

How to get rounded corners on an Electron app?


I am currently trying to get rounded corners on an Electron application I'm making. I have tried nearly every solution available on-line at the moment, but none of them make any difference.

How can I round the corners of my Electron app?


Solution

  • Make a frameless transparent window

    const myWindow = new BrowserWindow({
        transparent: true, 
        frame: false
    })
    

    And have something like this in the renderer, or apply the style directly to the body tag

    <div style="width: 500px; height: 500px; border-radius: 5px">My window content</div>
    

    Just make sure to also add a custom window titlebar that has -webkit-app-region: dragin order to make the window dragable from this element.

    Check out the Electron Docs for further informations ;) https://github.com/electron/electron/blob/master/docs/api/frameless-window.md#transparent-window