WebPreferences transparent option
The transparent boolean option (optional) controls whether to enable background transparency for the guest page. The default is true. The guest page's text and background colors are derived from the color-scheme CSS property of its root element. When transparency is enabled, the text color changes accordingly but the background remains transparent.
WebPreferences enableDeprecatedPaste option
The enableDeprecatedPaste boolean option (optional, deprecated) controls whether the paste execCommand is enabled. The default is false.
WebPreferences focusOnNavigation option
The focusOnNavigation boolean option (optional) controls whether to focus the WebContents when navigating. The default is true.
TouchBarButton enabled property
The enabled property is a boolean representing whether the button is in an enabled state.
TouchBarButton backgroundColor property
The backgroundColor property is a string hex code representing the button's current background color. Changing this value immediately updates the button in the touch bar.
TouchBarButton iconPosition property
The iconPosition property is a string that can be 'left', 'right', or 'overlay', defaulting to 'overlay'.
TouchBarColorPicker.availableColors property
touchBarColorPicker.availableColors is a string[] array representing the color picker's available colors to select. Changing this value immediately updates the color picker in the touch bar.
TouchBarColorPicker.selectedColor property
touchBarColorPicker.selectedColor is a string hex code representing the color picker's currently selected color. Changing this value immediately updates the color picker in the touch bar.
TouchBarGroup constructor options
The TouchBarGroup constructor accepts an options object with the following parameter: items (type: TouchBar) - Items to display as a group.
TouchBarLabel.textColor property
The touchBarLabel.textColor property is a string hex code representing the label's current text color. Changing this value immediately updates the label in the touch bar.
TouchBarPopover.label property
The label property is a string representing the popover's current button text. Changing this value immediately updates the popover in the touch bar.
TouchBarPopover.icon property
The icon property is a NativeImage representing the popover's current button icon. Changing this value immediately updates the popover in the touch bar.
systemPreferences.accessibilityDisplayShouldReduceTransparency property macOS deprecated
A readonly boolean property determining whether the app avoids using semitransparent backgrounds. Maps to NSWorkspace.accessibilityDisplayShouldReduceTransparency. This property is deprecated; use the new nativeTheme.prefersReducedTransparency API instead.
systemPreferences.effectiveAppearance property macOS
A readonly string property that can be 'dark', 'light', or 'unknown'. Returns the macOS appearance setting currently applied to the application, maps to NSApplication.effectiveAppearance.
TouchBarScrubber selectedStyle property
The selectedStyle property is a string representing the style that selected items in the scrubber should have. Updating this value immediately updates the control in the touch bar. Possible values are: 'background' (maps to NSScrubberSelectionStyle roundedBackgroundStyle), 'outline' (maps to NSScrubberSelectionStyle outlineOverlayStyle), or 'none' (removes all styles).
TouchBarScrubber items property
The items property is a ScrubberItem[] array representing the items in the scrubber. Updating this value immediately updates the control in the touch bar. However, updating deep properties inside this array does not update the touch bar.
TouchBarScrubber overlayStyle property
The overlayStyle property is a string representing the style that selected items in the scrubber should have. This style is overlaid on top of the scrubber item instead of being placed behind it. Updating this value immediately updates the control in the touch bar. Possible values are: 'background' (maps to NSScrubberSelectionStyle roundedBackgroundStyle), 'outline' (maps to NSScrubberSelectionStyle outlineOverlayStyle), or 'none' (removes all styles).
TouchBarScrubber showArrowButtons property
The showArrowButtons property is a boolean representing whether to show the left/right selection arrows in the scrubber. Updating this value immediately updates the control in the touch bar.
TouchBarScrubber mode property
The mode property is a string representing the mode of the scrubber. Updating this value immediately updates the control in the touch bar. Possible values are: 'fixed' (maps to NSScrubberModeFixed) or 'free' (maps to NSScrubberModeFree).
TouchBarScrubber continuous property
The continuous property is a boolean representing whether the scrubber is continuous or not. Updating this value immediately updates the control in the touch bar.
TouchBarSegmentedControl.segmentStyle property
segmentStyle is a string property representing the control's current segment style. Updating this value immediately updates the control in the touch bar.
TouchBarSegmentedControl.mode property
mode is a string property representing the current selection mode of the control. Possible values are 'single', 'multiple', or 'buttons'.
TouchBarSegmentedControl.selectedIndex property
selectedIndex is an Integer property representing the currently selected segment. Changing this value immediately updates the control in the touch bar. User interaction with the touch bar automatically updates this value.
TouchBarSegmentedControl.segments property
segments is a SegmentedControlSegment[] array property representing the segments in the control. Updating this value immediately updates the control in the touch bar. Important: Updating deep properties inside this array does not update the touch bar.
TouchBarSlider.label property
The touchBarSlider.label property is a string representing the slider's current text. Changing this value immediately updates the slider in the touch bar.
TouchBarSlider.value property
The touchBarSlider.value property is a number representing the slider's current value. Changing this value immediately updates the slider in the touch bar.
TouchBarSlider.minValue property
The touchBarSlider.minValue property is a number representing the slider's current minimum value. Changing this value immediately updates the slider in the touch bar.
TouchBarSlider.maxValue property
The touchBarSlider.maxValue property is a number representing the slider's current maximum value. Changing this value immediately updates the slider in the touch bar.
TouchBarSpacer.size property
The TouchBarSpacer instance property 'size' is a string representing the size of the spacer. It can have the values 'small', 'large', or 'flexible'.
Tray guid on Windows
On Windows, if the executable is signed and the signature contains an organization, the GUID is permanently associated with that signature and OS level settings like tray icon position persist even if the executable path changes. If the executable is not code-signed, the GUID is permanently associated with the executable path; changing the path will break tray icon creation. It is highly recommended to use the GUID parameter only with code-signed executables. If an app defines multiple tray icons, each must use a separate GUID.
Tray guid on macOS
On macOS, the guid is a string used to uniquely identify the tray icon and allow it to retain its position between relaunches. Using the same string for a new tray item creates it in the same position as the previous tray item that used the string.
Tray on Linux platform
On Linux, Tray icon uses StatusNotifierItem by default. When StatusNotifierItem is not available in the user's desktop environment, GtkStatusIcon is used instead. If StatusNotifierItem is available, the first tray icon created uses SNI, while subsequently-created icons use GtkStatusIcon. The click event is emitted when the tray icon receives activation, but the StatusNotifierItem spec does not specify which action causes activation; for some environments it is left mouse click, for others it might be double left mouse click. To make changes to individual MenuItems take effect on Linux, tray.setContextMenu() must be called again.
Tray on macOS platform
On macOS, icons passed to the Tray constructor should be Template Images. To ensure the icon isn't grainy on retina monitors, the @2x image should be 144dpi. If bundling the application with tools like webpack, filename mangling or hashing must be avoided; the filename needs to end in 'Template', and the @2x image needs the same filename as the standard image, otherwise macOS will not invert the image's colors or use the high density image. 16x16 (72dpi) and 32x32@2x (144dpi) work well for most icons.
Tray on Windows platform
On Windows, it is recommended to use ICO icons to get the best visual effects.
UtilityProcess.stdout property
child.stdout is a NodeJS.ReadableStream | null representing the child process's stdout. If the child was spawned with options.stdio[1] set to anything other than 'pipe', this is null. When the child process exits, this becomes null after the exit event is emitted.
UtilityProcess.pid property
child.pid is an Integer | undefined representing the process identifier (PID) of the child process. The value is undefined until the child process has spawned successfully. After the child process exits and the exit event is emitted, the value becomes undefined. The pid can be used to determine if the process is currently running.
UtilityProcess.stderr property
child.stderr is a NodeJS.ReadableStream | null representing the child process's stderr. If the child was spawned with options.stdio[2] set to anything other than 'pipe', this is null. When the child process exits, this becomes null after the exit event is emitted.
WebContentsView.webContents usage example
Example showing how to load a URL using the webContents property:
const { WebContentsView } = require('electron')
const view = new WebContentsView()
view.webContents.loadURL('https://electronjs.org/')
WebContentsView webContents property
The view.webContents property is a readonly WebContents property containing a reference to the displayed WebContents. Use this to interact with the WebContents, for instance to load a URL.
View children property
view.children is a read-only property that is a View[] array representing the child views of this view.
frame.visibilityState property
frame.visibilityState is a readonly property representing a string of the visibility state of the frame, as defined by the Page Visibility API.
frame.url property
frame.url is a readonly property representing a string of the current URL of the frame.
frame.origin property
frame.origin is a readonly property representing a string of the current origin of the frame, serialized according to RFC 6454. This may be different from the URL. For instance, if the frame is a child window opened to about:blank, frame.origin will return the parent frame's origin, while frame.url will return the empty string. Pages without a scheme/host/port triple origin will have the serialized origin of 'null' (the string containing the letters n, u, l, l).
frame.top property
frame.top is a readonly property representing WebFrameMain | null. It is the top frame in the frame hierarchy to which frame belongs.
frame.parent property
frame.parent is a readonly property representing WebFrameMain | null. It is the parent frame of frame. The property would be null if frame is the top frame in the frame hierarchy.
frame.frames property
frame.frames is a readonly property representing a WebFrameMain[] collection containing the direct descendents of frame.
frame.framesInSubtree property
frame.framesInSubtree is a readonly property representing a WebFrameMain[] collection containing every frame in the subtree of frame, including itself. This can be useful when traversing through all frames.
frame.frameTreeNodeId property
frame.frameTreeNodeId is a readonly property representing an Integer id of the frame's internal FrameTreeNode instance. This id is browser-global and uniquely identifies a frame that hosts content. The identifier is fixed at the creation of the frame and stays constant for the lifetime of the frame. When the frame is removed, the id is not used again.
frame.name property
frame.name is a readonly property representing a string of the frame name.
frame.osProcessId property
frame.osProcessId is a readonly property representing an Integer of the operating system pid of the process which owns this frame.
frame.processId property
frame.processId is a readonly property representing an Integer of the Chromium internal pid of the process which owns this frame. This is not the same as the OS process ID; to read that use frame.osProcessId.
frame.routingId property
frame.routingId is a readonly property representing an Integer of the unique frame id in the current renderer process. Distinct WebFrameMain instances that refer to the same underlying frame will have the same routingId.
frame.detached property
frame.detached is a readonly property representing a Boolean indicating whether the frame is detached from the frame tree. If a frame is accessed while the corresponding page is running any unload listeners, it may become detached as the newly navigated page replaced it in the frame tree.
webFrame.top property
A readonly property that is a WebFrame | null representing the top frame in the frame hierarchy to which webFrame belongs. The property is null if the top frame is not in the current renderer process.
webFrame.opener property
A readonly property that is a WebFrame | null representing the frame which opened webFrame. The property is null if there's no opener or the opener is not in the current renderer process.
webFrame.parent property
A readonly property that is a WebFrame | null representing the parent frame of webFrame. The property is null if webFrame is top or if the parent is not in the current renderer process.
webFrame.firstChild property
A readonly property that is a WebFrame | null representing the first child frame of webFrame. The property is null if webFrame has no children or if the first child is not in the current renderer process.
webFrame.nextSibling property
A readonly property that is a WebFrame | null representing the next sibling frame. The property is null if webFrame is the last frame in its parent or if the next sibling is not in the current renderer process.
webFrame.routingId property deprecated
A readonly Integer representing the unique frame id in the current renderer process. Distinct WebFrame instances that refer to the same underlying frame will have the same routingId. This property is deprecated; use the new webFrame.frameToken API instead.
webFrame.frameToken property
A readonly string representing the unique frame token in the current renderer process. Distinct WebFrame instances that refer to the same underlying frame will have the same frameToken.