BrowserWindowConstructorOptions Object
width
Integer (optional) - Window’s width in pixels. Default is800
.height
Integer (optional) - Window’s height in pixels. Default is600
.x
Integer (optional) - (required if y is used) Window’s left offset from screen. Default is to center the window.y
Integer (optional) - (required if x is used) Window’s top offset from screen. Default is to center the window.useContentSize
boolean (optional) - Thewidth
andheight
would be used as web page’s size, which means the actual window’s size will include window frame’s size and be slightly larger. Default isfalse
.center
boolean (optional) - Show window in the center of the screen. Default isfalse
.minWidth
Integer (optional) - Window’s minimum width. Default is0
.minHeight
Integer (optional) - Window’s minimum height. Default is0
.maxWidth
Integer (optional) - Window’s maximum width. Default is no limit.maxHeight
Integer (optional) - Window’s maximum height. Default is no limit.resizable
boolean (optional) - Whether window is resizable. Default istrue
.movable
boolean (optional) macOS Windows - Whether window is movable. This is not implemented on Linux. Default istrue
.minimizable
boolean (optional) macOS Windows - Whether window is minimizable. This is not implemented on Linux. Default istrue
.maximizable
boolean (optional) macOS Windows - Whether window is maximizable. This is not implemented on Linux. Default istrue
.closable
boolean (optional) macOS Windows - Whether window is closable. This is not implemented on Linux. Default istrue
.focusable
boolean (optional) - Whether the window can be focused. Default istrue
. On Windows settingfocusable: false
also implies settingskipTaskbar: true
. On Linux settingfocusable: false
makes the window stop interacting with wm, so the window will always stay on top in all workspaces.alwaysOnTop
boolean (optional) - Whether the window should always stay on top of other windows. Default isfalse
.fullscreen
boolean (optional) - Whether the window should show in fullscreen. When explicitly set tofalse
the fullscreen button will be hidden or disabled on macOS. Default isfalse
.fullscreenable
boolean (optional) - Whether the window can be put into fullscreen mode. On macOS, also whether the maximize/zoom button should toggle full screen mode or maximize window. Default istrue
.simpleFullscreen
boolean (optional) macOS - Use pre-Lion fullscreen on macOS. Default isfalse
.skipTaskbar
boolean (optional) macOS Windows - Whether to show the window in taskbar. Default isfalse
.hiddenInMissionControl
boolean (optional) macOS - Whether window should be hidden when the user toggles into mission control.kiosk
boolean (optional) - Whether the window is in kiosk mode. Default isfalse
.title
string (optional) - Default window title. Default is"Electron"
. If the HTML tag<title>
is defined in the HTML file loaded byloadURL()
, this property will be ignored.icon
(NativeImage | string) (optional) - The window icon. On Windows it is recommended to useICO
icons to get best visual effects, you can also leave it undefined so the executable’s icon will be used.show
boolean (optional) - Whether window should be shown when created. Default istrue
.paintWhenInitiallyHidden
boolean (optional) - Whether the renderer should be active whenshow
isfalse
and it has just been created. In order fordocument.visibilityState
to work correctly on first load withshow: false
you should set this tofalse
. Setting this tofalse
will cause theready-to-show
event to not fire. Default istrue
.frame
boolean (optional) - Specifyfalse
to create a frameless window. Default istrue
.parent
BrowserWindow (optional) - Specify parent window. Default isnull
.modal
boolean (optional) - Whether this is a modal window. This only works when the window is a child window. Default isfalse
.acceptFirstMouse
boolean (optional) macOS - Whether clicking an inactive window will also click through to the web contents. Default isfalse
on macOS. This option is not configurable on other platforms.disableAutoHideCursor
boolean (optional) - Whether to hide cursor when typing. Default isfalse
.autoHideMenuBar
boolean (optional) - Auto hide the menu bar unless theAlt
key is pressed. Default isfalse
.enableLargerThanScreen
boolean (optional) macOS - Enable the window to be resized larger than screen. Only relevant for macOS, as other OSes allow larger-than-screen windows by default. Default isfalse
.backgroundColor
string (optional) - The window’s background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. Alpha in #AARRGGBB format is supported iftransparent
is set totrue
. Default is#FFF
(white). See win.setBackgroundColor for more information.hasShadow
boolean (optional) - Whether window should have a shadow. Default istrue
.opacity
number (optional) macOS Windows - Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0 (fully opaque). This is only implemented on Windows and macOS.darkTheme
boolean (optional) - Forces using dark theme for the window, only works on some GTK+3 desktop environments. Default isfalse
.transparent
boolean (optional) - Makes the window transparent. Default isfalse
. On Windows, does not work unless the window is frameless.type
string (optional) - The type of window, default is normal window. See more about this below.visualEffectState
string (optional) macOS - Specify how the material appearance should reflect window activity state on macOS. Must be used with thevibrancy
property. Possible values are:followWindow
- The backdrop should automatically appear active when the window is active, and inactive when it is not. This is the default.active
- The backdrop should always appear active.inactive
- The backdrop should always appear inactive.
titleBarStyle
string (optional) macOS Windows - The style of window title bar. Default isdefault
. Possible values are:default
- Results in the standard title bar for macOS or Windows respectively.hidden
- Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined withtitleBarOverlay: true
it will activate the Window Controls Overlay (seetitleBarOverlay
for more information), otherwise no window controls will be shown.hiddenInset
macOS - Only on macOS, results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.customButtonsOnHover
macOS - Only on macOS, results in a hidden title bar and a full size content window, the traffic light buttons will display when being hovered over in the top left of the window. Note: This option is currently experimental.
trafficLightPosition
Point (optional) macOS - Set a custom position for the traffic light buttons in frameless windows.roundedCorners
boolean (optional) macOS - Whether frameless window should have rounded corners on macOS. Default istrue
. Setting this property tofalse
will prevent the window from being fullscreenable.fullscreenWindowTitle
boolean (optional) macOS Deprecated - Shows the title in the title bar in full screen mode on macOS forhiddenInset
titleBarStyle. Default isfalse
.thickFrame
boolean (optional) - UseWS_THICKFRAME
style for frameless windows on Windows, which adds standard window frame. Setting it tofalse
will remove window shadow and window animations. Default istrue
.vibrancy
string (optional) macOS - Add a type of vibrancy effect to the window, only on macOS. Can beappearance-based
,titlebar
,selection
,menu
,popover
,sidebar
,header
,sheet
,window
,hud
,fullscreen-ui
,tooltip
,content
,under-window
, orunder-page
.backgroundMaterial
string (optional) Windows - Set the window’s system-drawn background material, including behind the non-client area. Can beauto
,none
,mica
,acrylic
ortabbed
. See win.setBackgroundMaterial for more information.zoomToPageWidth
boolean (optional) macOS - Controls the behavior on macOS when option-clicking the green stoplight button on the toolbar or by clicking the Window > Zoom menu item. Iftrue
, the window will grow to the preferred width of the web page when zoomed,false
will cause it to zoom to the width of the screen. This will also affect the behavior when callingmaximize()
directly. Default isfalse
.tabbingIdentifier
string (optional) macOS - Tab group name, allows opening the window as a native tab. Windows with the same tabbing identifier will be grouped together. This also adds a native new tab button to your window’s tab bar and allows yourapp
and window to receive thenew-window-for-tab
event.webPreferences
WebPreferences (optional) - Settings of web page’s features.devTools
boolean (optional) - Whether to enable DevTools. If it is set tofalse
, can not useBrowserWindow.webContents.openDevTools()
to open DevTools. Default istrue
.nodeIntegration
boolean (optional) - Whether node integration is enabled. Default isfalse
.nodeIntegrationInWorker
boolean (optional) - Whether node integration is enabled in web workers. Default isfalse
. More about this can be found in Multithreading.nodeIntegrationInSubFrames
boolean (optional) - Experimental option for enabling Node.js support in sub-frames such as iframes and child windows. All your preloads will load for every iframe, you can useprocess.isMainFrame
to determine if you are in the main frame or not.preload
string (optional) - Specifies a script that will be loaded before other scripts run in the page. This script will always have access to node APIs no matter whether node integration is turned on or off. The value should be the absolute file path to the script. When node integration is turned off, the preload script can reintroduce Node global symbols back to the global scope. See example here.sandbox
boolean (optional) - If set, this will sandbox the renderer associated with the window, making it compatible with the Chromium OS-level sandbox and disabling the Node.js engine. This is not the same as thenodeIntegration
option and the APIs available to the preload script are more limited. Read more about the option here.session
Session (optional) - Sets the session used by the page. Instead of passing the Session object directly, you can also choose to use thepartition
option instead, which accepts a partition string. When bothsession
andpartition
are provided,session
will be preferred. Default is the default session.partition
string (optional) - Sets the session used by the page according to the session’s partition string. Ifpartition
starts withpersist:
, the page will use a persistent session available to all pages in the app with the samepartition
. If there is nopersist:
prefix, the page will use an in-memory session. By assigning the samepartition
, multiple pages can share the same session. Default is the default session.zoomFactor
number (optional) - The default zoom factor of the page,3.0
represents300%
. Default is1.0
.javascript
boolean (optional) - Enables JavaScript support. Default istrue
.webSecurity
boolean (optional) - Whenfalse
, it will disable the same-origin policy (usually using testing websites by people), and setallowRunningInsecureContent
totrue
if this options has not been set by user. Default istrue
.allowRunningInsecureContent
boolean (optional) - Allow an https page to run JavaScript, CSS or plugins from http URLs. Default isfalse
.images
boolean (optional) - Enables image support. Default istrue
.imageAnimationPolicy
string (optional) - Specifies how to run image animations (E.g. GIFs). Can beanimate
,animateOnce
ornoAnimation
. Default isanimate
.textAreasAreResizable
boolean (optional) - Make TextArea elements resizable. Default istrue
.webgl
boolean (optional) - Enables WebGL support. Default istrue
.plugins
boolean (optional) - Whether plugins should be enabled. Default isfalse
.experimentalFeatures
boolean (optional) - Enables Chromium’s experimental features. Default isfalse
.scrollBounce
boolean (optional) macOS - Enables scroll bounce (rubber banding) effect on macOS. Default isfalse
.enableBlinkFeatures
string (optional) - A list of feature strings separated by,
, likeCSSVariables,KeyboardEventKey
to enable. The full list of supported feature strings can be found in the RuntimeEnabledFeatures.json5 file.disableBlinkFeatures
string (optional) - A list of feature strings separated by,
, likeCSSVariables,KeyboardEventKey
to disable. The full list of supported feature strings can be found in the RuntimeEnabledFeatures.json5 file.defaultFontFamily
Object (optional) - Sets the default font for the font-family.standard
string (optional) - Defaults toTimes New Roman
.serif
string (optional) - Defaults toTimes New Roman
.sansSerif
string (optional) - Defaults toArial
.monospace
string (optional) - Defaults toCourier New
.cursive
string (optional) - Defaults toScript
.fantasy
string (optional) - Defaults toImpact
.math
string (optional) - Defaults toLatin Modern Math
.
defaultFontSize
Integer (optional) - Defaults to16
.defaultMonospaceFontSize
Integer (optional) - Defaults to13
.minimumFontSize
Integer (optional) - Defaults to0
.defaultEncoding
string (optional) - Defaults toISO-8859-1
.backgroundThrottling
boolean (optional) - Whether to throttle animations and timers when the page becomes background. This also affects the Page Visibility API. Defaults totrue
.offscreen
boolean (optional) - Whether to enable offscreen rendering for the browser window. Defaults tofalse
. See the offscreen rendering tutorial for more details.contextIsolation
boolean (optional) - Whether to run Electron APIs and the specifiedpreload
script in a separate JavaScript context. Defaults totrue
. The context that thepreload
script runs in will only have access to its own dedicateddocument
andwindow
globals, as well as its own set of JavaScript builtins (Array
,Object
,JSON
, etc.), which are all invisible to the loaded content. The Electron API will only be available in thepreload
script and not the loaded page. This option should be used when loading potentially untrusted remote content to ensure the loaded content cannot tamper with thepreload
script and any Electron APIs being used. This option uses the same technique used by Chrome Content Scripts. You can access this context in the dev tools by selecting the ‘Electron Isolated Context’ entry in the combo box at the top of the Console tab.webviewTag
boolean (optional) - Whether to enable thetag . Defaults tofalse
. Note: Thepreload
script configured for the<webview>
will have node integration enabled when it is executed so you should ensure remote/untrusted content is not able to create a<webview>
tag with a possibly maliciouspreload
script. You can use thewill-attach-webview
event on webContents to strip away thepreload
script and to validate or alter the<webview>
‘s initial settings.additionalArguments
string[] (optional) - A list of strings that will be appended toprocess.argv
in the renderer process of this app. Useful for passing small bits of data down to renderer process preload scripts.safeDialogs
boolean (optional) - Whether to enable browser style consecutive dialog protection. Default isfalse
.safeDialogsMessage
string (optional) - The message to display when consecutive dialog protection is triggered. If not defined the default message would be used, note that currently the default message is in English and not localized.disableDialogs
boolean (optional) - Whether to disable dialogs completely. OverridessafeDialogs
. Default isfalse
.navigateOnDragDrop
boolean (optional) - Whether dragging and dropping a file or link onto the page causes a navigation. Default isfalse
.autoplayPolicy
string (optional) - Autoplay policy to apply to content in the window, can beno-user-gesture-required
,user-gesture-required
,document-user-activation-required
. Defaults tono-user-gesture-required
.disableHtmlFullscreenWindowResize
boolean (optional) - Whether to prevent the window from resizing when entering HTML Fullscreen. Default isfalse
.accessibleTitle
string (optional) - An alternative title string provided only to accessibility tools such as screen readers. This string is not directly visible to users.spellcheck
boolean (optional) - Whether to enable the builtin spellchecker. Default istrue
.enableWebSQL
boolean (optional) - Whether to enable the WebSQL api. Default istrue
.v8CacheOptions
string (optional) - Enforces the v8 code caching policy used by blink. Accepted values arenone
- Disables code cachingcode
- Heuristic based code cachingbypassHeatCheck
- Bypass code caching heuristics but with lazy compilationbypassHeatCheckAndEagerCompile
- Same as above except compilation is eager. Default policy iscode
.
enablePreferredSizeMode
boolean (optional) - Whether to enable preferred size mode. The preferred size is the minimum size needed to contain the layout of the document—without requiring scrolling. Enabling this will cause thepreferred-size-changed
event to be emitted on theWebContents
when the preferred size changes. Default isfalse
.
titleBarOverlay
Object | Boolean (optional) - When using a frameless window in conjunction withwin.setWindowButtonVisibility(true)
on macOS or using atitleBarStyle
so that the standard window controls (“traffic lights” on macOS) are visible, this property enables the Window Controls Overlay JavaScript APIs and CSS Environment Variables. Specifyingtrue
will result in an overlay with default system colors. Default isfalse
.color
String (optional) Windows - The CSS color of the Window Controls Overlay when enabled. Default is the system color.symbolColor
String (optional) Windows - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.height
Integer (optional) macOS Windows - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
When setting minimum or maximum window size with minWidth
/maxWidth
/ minHeight
/maxHeight
, it only constrains the users. It won’t prevent you from passing a size that does not follow size constraints to setBounds
/setSize
or to the constructor of BrowserWindow
.
The possible values and behaviors of the type
option are platform dependent. Possible values are:
- On Linux, possible types are
desktop
,dock
,toolbar
,splash
,notification
.- The
desktop
type places the window at the desktop background window level (kCGDesktopWindowLevel - 1). However, note that a desktop window will not receive focus, keyboard, or mouse events. You can still use globalShortcut to receive input sparingly. - The
dock
type creates a dock-like window behavior. - The
toolbar
type creates a window with a toolbar appearance. - The
splash
type behaves in a specific way. It is not draggable, even if the CSS styling of the window’s body contains -webkit-app-region: drag. This type is commonly used for splash screens. - The
notification
type creates a window that behaves like a system notification.
- The
- On macOS, possible types are
desktop
,textured
,panel
.- The
textured
type adds metal gradient appearance (NSWindowStyleMaskTexturedBackground
). - The
desktop
type places the window at the desktop background window level (kCGDesktopWindowLevel - 1
). Note that desktop window will not receive focus, keyboard or mouse events, but you can useglobalShortcut
to receive input sparingly. - The
panel
type enables the window to float on top of full-screened apps by adding theNSWindowStyleMaskNonactivatingPanel
style mask,normally reserved for NSPanel, at runtime. Also, the window will appear on all spaces (desktops).
- The
- On Windows, possible type is
toolbar
.