You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request]: Allow rounded corners on WebContentsView #42288
I agree to follow the Code of Conduct that this project adheres to.
I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Problem Description
The WebContentsView in Electron currently only supports rectangular corners. Allowing customizable rounded corners would enable more flexible, modern designs for Electron apps.
Proposed Solution
Add a new method to the WebContentsView to set the corner radius:
const{ BaseWindow, WebContentsView }=require('electron')constwin=newBaseWindow({width: 800,height: 400})constview1=newWebContentsView()win.contentView.addChildView(view1)view1.webContents.loadURL('https://electronjs.org')view1.setBounds({x: 0,y: 0,width: 400,height: 400})view1.setRoundedCorners(20);// for 20px
Alternatives Considered
Add an option to WebContentsView constructor to set corner radius:
constview1=newWebContentsView({roundedCorners: 20});// for 20px
Activity
samuelmaddock commentedon May 30, 2024
Tagging a similar issue request, for the now deprecated BrowserView #33426
liuyike98 commentedon Jul 20, 2024
@jkleinsc any version can preview this feature?
samuelmaddock commentedon Jul 30, 2024
@liuyike98 this'll be available in electron v33. you can access it via electron-nightly for an early preview.
liuyike98 commentedon Oct 28, 2024
@samuelmaddock webContentsView overflow the parent view which has border radius.