Header menu logo fable-electron-docs-api

TouchBarButton Type

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

Create a button in the touch bar for native macOS applicationsProcess: Main This class is not exported from the 'electron' module. It is only available as a return value of other methods in the Electron API.

Constructors

Constructor Description

TouchBarButton(?label, ?accessibilityLabel, ?backgroundColor, ?icon, ?iconPosition, ?click, ?enabled)

Full Usage: TouchBarButton(?label, ?accessibilityLabel, ?backgroundColor, ?icon, ?iconPosition, ?click, ?enabled)

Parameters:
    ?label : string - Button text.
    ?accessibilityLabel : string - A short description of the button for use by screenreaders like VoiceOver.
    ?backgroundColor : string - Button background color in hex format, i.e #ABCDEF.
    ?icon : U2<NativeImage, string> - Button icon.
    ?iconPosition : IconPosition - Can be left, right or overlay. Defaults to overlay.
    ?click : unit -> unit - Function to call when the button is clicked.
    ?enabled : bool - Whether the button is in an enabled state. Default is true.

Returns: TouchBarButton
?label : string

Button text.

?accessibilityLabel : string

A short description of the button for use by screenreaders like VoiceOver.

?backgroundColor : string

Button background color in hex format, i.e #ABCDEF.

?icon : U2<NativeImage, string>

Button icon.

?iconPosition : IconPosition

Can be left, right or overlay. Defaults to overlay.

?click : unit -> unit

Function to call when the button is clicked.

?enabled : bool

Whether the button is in an enabled state. Default is true.

Returns: TouchBarButton

Instance members

Instance member Description

this.accessibilityLabel

Full Usage: this.accessibilityLabel

A string representing the description of the button to be read by a screen reader. Will only be read by screen readers if no label is set.

this.backgroundColor

Full Usage: this.backgroundColor

A string hex code representing the button's current background color. Changing this value immediately updates the button in the touch bar.

this.enabled

Full Usage: this.enabled

A boolean representing whether the button is in an enabled state.

this.icon

Full Usage: this.icon

A NativeImage representing the button's current icon. Changing this value immediately updates the button in the touch bar.

this.iconPosition

Full Usage: this.iconPosition

A string - Can be left, right or overlay. Defaults to overlay.

this.label

Full Usage: this.label

A string representing the button's current text. Changing this value immediately updates the button in the touch bar.

Type something to start searching.