BrowserWindow wraps a native OS window and provides full control over its appearance, behavior, and content. You create a BrowserWindow through the application factory — never via new BrowserWindow() directly — and then attach a Webview to it to display web content.
Creation Options
Pass aBrowserWindowOptions object to app.createBrowserWindow() or app.createChildBrowserWindow().
Basic
Behavior
Fullscreen
Menu
See the Menus guide for the
MenuOptions shape.
Windows-specific options
macOS-specific options
iOS-specific options
Creating a Webview
Attach a browser view to the window by callingcreateWebview(). It returns a Webview object you use to control the content.
Webview for as long as you need it. Do not discard the wrapper into a temporary variable.
WebviewOptions reference.
Window State Methods
Control visibility and window chrome at runtime:Size and Position
All size and position methods accept an optionallogical boolean. When true, values are interpreted as logical (CSS / device-independent) pixels. When false (the default), values are physical pixels.
Cursor Control
CursorType values
All 35CursorType values are available:
Default · Crosshair · Hand · Arrow · Move · Text · Wait · Help · Progress · NotAllowed · ContextMenu · Cell · VerticalText · Alias · Copy · NoDrop · Grab · Grabbing · ZoomIn · ZoomOut · ResizeEast · ResizeNorth · ResizeNorthEast · ResizeNorthWest · ResizeSouth · ResizeSouthEast · ResizeSouthWest · ResizeWest · ResizeEastWest · ResizeNorthSouth · ResizeNorthEastSouthWest · ResizeNorthWestSouthEast · ResizeColumn · ResizeRow · AllScroll
Decorations and Behavior
Theme values: Theme.Light, Theme.Dark, Theme.System.
Icon and Progress Bar
Window icon
Set the window’s icon from an RGBA pixel buffer:icon is a raw byte array of width × height × 4 bytes in RGBA order (red, green, blue, alpha, each 0–255).
Progress bar
Display a progress bar in the window’s taskbar button (Windows) or dock icon (macOS):File Dialogs
Open a native file picker and get the selected paths. This call blocks until the user dismisses the dialog and returns the selected paths synchronously:Monitor Info
Query information about the displays attached to the system:Monitor object has:
Custom Protocols
Register a URL-scheme handler to serve your own content to the webview. You must callregisterProtocol() before calling createWebview() on the same window.
Request and should return a standard Response (compatible with Hono, itty-router, and any Fetch-API framework) or a legacy CustomProtocolResponse plain object.
State Properties
Read the current window state through these properties and methods:Window Events
BrowserWindow extends Node.js EventEmitter. All positional values (x, y, width, height, deltaX, deltaY) are in physical pixels at the current DPI. Divide by win.scaleFactor() to convert to logical (CSS) pixels.
Event reference
Usage example
Identity and Native Handles
getNativeHandle() returns the platform-native handle as a bigint pointer value:
Returns
0n when no supported handle is available for the current platform. Treat this as a borrowed value — do not destroy it or pass ownership to native code.
Platform-Specific Extensions
Windows
macOS
Linux (Wayland)
Android
Disposal
Callwin.dispose() when you want to release a window before app.exit():
using declaration for automatic cleanup:
Webview instances attached to it. app.exit() disposes every window owned by the application.