Skip to content

[Feature Request]: Allow rounded corners on WebContentsView #42288

@spikecodes

Description

@spikecodes

Preflight Checklist

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')
const win = new BaseWindow({ width: 800, height: 400 })

const view1 = new WebContentsView()
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:

const view1 = new WebContentsView({ roundedCorners: 20 }); // for 20px

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions