Documentation Index
Fetch the complete documentation index at: https://mintlify.com/webviewjs/webview/llms.txt
Use this file to discover all available pages before exploring further.
BrowserWindow represents a native OS window managed by Tao. You never instantiate it directly — create one via app.createBrowserWindow() or app.createChildBrowserWindow(). Once you have a window you can attach a Webview to it, subscribe to input and lifecycle events, and adjust every aspect of the window’s appearance and behavior at runtime.
Keep the
BrowserWindow reference alive for as long as the window should exist. app.exit() disposes every window owned by the application; call win.dispose() for earlier cleanup.Creation Options
Pass these toapp.createBrowserWindow(options):
General Options
Window title shown in the title bar and taskbar.
Initial window width in physical pixels (or logical if
logical: true).Initial window height in physical pixels (or logical if
logical: true).Initial left (x) position of the window.
Initial top (y) position of the window.
When
true, width, height, x, and y are interpreted as logical (CSS/DPI-independent) pixels instead of physical pixels.Whether the user can resize the window.
Whether the window is initially visible.
Show the native title bar and border. Set to
false for a fully custom-drawn chrome.Enable a transparent window background. Requires
decorations: false on most platforms.Start the window in a maximized state.
Allow the user to maximize the window.
Allow the user to minimize the window.
Give the window keyboard focus when it opens.
Keep the window above all other windows.
Keep the window below all other windows (useful for desktop widgets).
Prevent the window content from appearing in screenshots or screen recordings.
Show the window on all virtual desktops / workspaces (macOS and Linux).
Initial fullscreen mode.
FullscreenType.Exclusive (0) or FullscreenType.Borderless (1).Per-window menu, overrides the global application menu for this window.
Show the global application menu on this specific window.
Windows-Specific Options
HWND of the owner window, for creating owned/popup windows on Windows.
Custom taskbar icon
{ data: Buffer, width?: number, height?: number }.Disable the Windows redirection bitmap (DirectComposition layered windows).
Enable native OLE drag-and-drop support.
Omit the window from the Windows taskbar.
Custom Win32 window class name registered with
RegisterClassEx.Draw a native drop shadow for undecorated (
decorations: false) windows.macOS-Specific Options
Allow the window to be dragged by clicking on its background content area.
Make the title bar background transparent so content can extend beneath it.
Hide the window title text while keeping the title bar chrome.
Hide the entire title bar, giving a full-height content area.
Hide the traffic-light (close/minimize/maximize) buttons.
Extend content under the title bar for full-bleed layouts.
Force 1× pixel density even on HiDPI/Retina displays.
Control the macOS window drop shadow (default: platform default).
Group windows into macOS native tabs by assigning the same identifier.
iOS-Specific Options
Override the screen scale factor for the window.
Allowed screen orientations.
LandscapeAndPortrait (0), Landscape (1), or Portrait (2).Request that the home indicator be hidden.
Bitmask of edges that defer system gestures: top
1, left 2, bottom 4, right 8.Request that the status bar be hidden.
Webview Creation
createWebview(options?, webContext?)
Attach a webview to this window. Returns a Webview instance that you must keep in application state.
See Webview options for all fields.
A
WebContext created via app.createWebContext() to share cookie and storage data across webviews.The new
Webview instance. Do not discard this reference.registerProtocol(name, handler)
Register a URL-scheme handler on this window before calling createWebview(). The handler receives a Fetch API Request and should return a Response (or a legacy CustomProtocolResponse plain object).
The scheme name, e.g.
'app' to handle app://… URLs.Called for every request matching the scheme. Compatible with Hono, itty-router, and any Fetch-API framework.
Window State
Visibility & lifecycle
New window title string.
title getter
Minimize / Maximize / Fullscreen
null to setFullscreen to exit fullscreen.
State predicates
State setters
isChild getter
true for windows created via app.createChildBrowserWindow().
id()
hasMenu()
true if the window currently has a menu attached.
Size & Position
All size and position methods accept an optionallogical boolean. When true, values are in logical (DPI-independent) pixels; when false (the default), values are in physical pixels.
Inner and outer dimensions
{ width: number, height: number }setSize(width, height, logical?)
null if the change was rejected by the platform.
Min / Max constraints
Position
Dimension getters (physical pixels)
scaleFactor()
Visual Appearance
Decorations & layering
Theme
Icons
Progress bar
Shadow (Windows undecorated)
Cursor
CursorType values: 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.
File Dialogs
openFileDialog(options?)
Array of absolute file paths selected by the user, or an empty array if cancelled.
Monitors
Platform-Specific Extensions
Identity & native handles
getNativeHandle() returns the platform-native handle as a bigint pointer: HWND on Windows, NSView on macOS, XID on X11, or a wl_surface pointer on Wayland. Returns 0n when no supported handle is available. Treat as a borrowed reference — do not destroy it.
getNativeHandleAnyThread() is the Windows-specific variant safe to call from non-main threads.
macOS runtime extensions
Linux runtime extensions
0n when not on Wayland.
iOS runtime extensions
1, left 2, bottom 4, right 8.
Android runtime extensions
Runtime methods called on an unsupported platform return neutral values or do nothing — they do not throw.
Events
BrowserWindow extends Node.js EventEmitter with a fully typed event map. Use .on(), .once(), .off(), and .removeAllListeners().
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 | Payload | Description |
|---|---|---|
move | { event, x, y } | Window moved |
resize | { event, width, height } | Window resized |
close | { event } | Window close requested |
focus | { event } | Window gained focus |
blur | { event } | Window lost focus |
mouse-enter | { event, x, y } | Cursor entered window |
mouse-leave | { event } | Cursor left window |
mouse-move | { event, x, y } | Cursor moved inside window |
mouse-down | { event, x, y, button } | Mouse button pressed (0=left, 1=middle, 2=right) |
mouse-up | { event, x, y, button } | Mouse button released |
scroll | { event, deltaX, deltaY } | Scroll/wheel input |
key-down | { event, key, code, modifiers, isRepeat } | Key pressed |
key-up | { event, key, code, modifiers, isRepeat } | Key released |
file-drop | { event, files } | Files dropped onto window |
file-hover | { event, files } | Files dragged over window |
file-hover-cancelled | { event } | Drag cancelled |
scale-factor-changed | { event, scaleFactor } | DPI changed |
theme-changed | { event, text } | OS theme changed ("light" or "dark") |
ime | { event, text, phase } | IME composition (phases: enabled, preedit, commit, disabled) |
touch | { event, x, y, touchId, phase } | Touch input (phases: started, moved, ended, cancelled) |
1=Shift, 2=Ctrl, 4=Alt, 8=Meta/Super/Command.
Windows created with
{ decorations: false, resizable: true } use Tao’s native platform behaviour for drag-resize — no extra code is required.Disposal
win.dispose() for early cleanup. Disposal is idempotent. Disposing a window also disposes all webviews attached to it. Use Symbol.dispose with using for automatic cleanup: