Header menu logo fable-electron-docs-api

clipboard Type

⚠ Process Availability: Main ✔ | Renderer ✔ | Utility ❌ | Exported ✔

Perform copy and paste operations on the system clipboard.Process: Main, Renderer (non-sandboxed only)> [!IMPORTANT] If you want to call this API from a renderer process with context isolation enabled, place the API call in your preload script and expose it using the contextBridge API.On Linux, there is also a selection clipboard. To manipulate it you need to pass selection to each method:

Static members

Static member Description

clipboard.availableFormats ?type

Full Usage: clipboard.availableFormats ?type

Parameters:
Returns: string[]
Modifiers: inline

An array of supported formats for the clipboard type.

?type : Type
Returns: string[]

clipboard.clear ?type

Full Usage: clipboard.clear ?type

Parameters:
Modifiers: inline

Clears the clipboard content.

?type : Type

clipboard.has (format, ?type)

Full Usage: clipboard.has (format, ?type)

Parameters:
    format : string
    ?type : Type

Returns: bool
Modifiers: inline

Whether the clipboard supports the specified format.

format : string
?type : Type
Returns: bool

clipboard.read format

Full Usage: clipboard.read format

Parameters:
    format : string

Returns: string
Modifiers: inline

Reads format type from the clipboard.format should contain valid ASCII characters and have / separator. a/c, a/bc are valid formats while /abc, abc/, a/, /a, a are not valid.

format : string
Returns: string

clipboard.readBookmark ()

Full Usage: clipboard.readBookmark ()

Returns: ReadBookmark
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

  • title string* url stringReturns an Object containing title and url keys representing the bookmark in the clipboard. The title and url values will be empty strings when the bookmark is unavailable. The title value will always be empty on Windows.

Returns: ReadBookmark

clipboard.readBuffer format

Full Usage: clipboard.readBuffer format

Parameters:
    format : string

Returns: Buffer
Modifiers: inline

Reads format type from the clipboard.

format : string
Returns: Buffer

clipboard.readFindText ()

Full Usage: clipboard.readFindText ()

Returns: string
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

The text on the find pasteboard, which is the pasteboard that holds information about the current state of the active application’s find panel.This method uses synchronous IPC when called from the renderer process. The cached value is reread from the find pasteboard whenever the application is activated.

Returns: string

clipboard.readHTML ?type

Full Usage: clipboard.readHTML ?type

Parameters:
Returns: string
Modifiers: inline

The content in the clipboard as markup.

?type : Type
Returns: string

clipboard.readImage ?type

Full Usage: clipboard.readImage ?type

Parameters:
Returns: NativeImage
Modifiers: inline

The image content in the clipboard.

?type : Type
Returns: NativeImage

clipboard.readRTF ?type

Full Usage: clipboard.readRTF ?type

Parameters:
Returns: string
Modifiers: inline

The content in the clipboard as RTF.

?type : Type
Returns: string

clipboard.readText ?type

Full Usage: clipboard.readText ?type

Parameters:
Returns: string
Modifiers: inline

The content in the clipboard as plain text.

?type : Type
Returns: string

clipboard.write (data, ?type)

Full Usage: clipboard.write (data, ?type)

Parameters:
Modifiers: inline

Writes data to the clipboard.

data : Data
?type : Type

clipboard.writeBookmark (title, url, ?type)

Full Usage: clipboard.writeBookmark (title, url, ?type)

Parameters:
    title : string
    url : string
    ?type : Type

Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Writes the title (macOS only) and url into the clipboard as a bookmark.> [!NOTE] Most apps on Windows don't support pasting bookmarks into them so you can use clipboard.write to write both a bookmark and fallback text to the clipboard.

title : string
url : string
?type : Type

clipboard.writeBuffer (format, buffer, ?type)

Full Usage: clipboard.writeBuffer (format, buffer, ?type)

Parameters:
Modifiers: inline

Writes the buffer into the clipboard as format.

format : string
buffer : Buffer
?type : Type

clipboard.writeFindText text

Full Usage: clipboard.writeFindText text

Parameters:
    text : string

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Writes the text into the find pasteboard (the pasteboard that holds information about the current state of the active application’s find panel) as plain text. This method uses synchronous IPC when called from the renderer process.

text : string

clipboard.writeHTML (markup, ?type)

Full Usage: clipboard.writeHTML (markup, ?type)

Parameters:
    markup : string
    ?type : Type

Modifiers: inline

Writes markup to the clipboard.

markup : string
?type : Type

clipboard.writeImage (image, ?type)

Full Usage: clipboard.writeImage (image, ?type)

Parameters:
Modifiers: inline

Writes image to the clipboard.

image : NativeImage
?type : Type

clipboard.writeRTF (text, ?type)

Full Usage: clipboard.writeRTF (text, ?type)

Parameters:
    text : string
    ?type : Type

Modifiers: inline

Writes the text into the clipboard in RTF.

text : string
?type : Type

clipboard.writeText (text, ?type)

Full Usage: clipboard.writeText (text, ?type)

Parameters:
    text : string
    ?type : Type

Modifiers: inline

Writes the text into the clipboard as plain text.

text : string
?type : Type

Type something to start searching.