Saltar al contenido principal

Clase: TouchBarButton

Clase: TouchBarButton​

Crea un botón en la barra táctil para aplicaciones macOS nativas

Process: Main
This class is not exported from the 'electron' module. Sólo está disponible como un valor de retorno de otros métodos en la API de Electron.

new TouchBarButton(options)​

  • options Object
    • Etiqueta cadena (opcional) - Texto del fondo.
    • accessibilityLabel string (opcional) - Una breve descripción del botón para su uso por lectores de pantalla como VoiceOver.
    • Color del fondo cadena (opcional) - Color del fondo en formato hex, ejemplo: #ABCDEF.
    • icon NativeImage | string (optional) - Button icon.
    • posición del ícono cadena (opcional) - Puede ser izquierda, derecha o superpuesto. Por defecto es overlay.
    • click Función (opcional) - Función a llamar cuando se hace click en el fondo.
    • enabled boolean (optional) - Whether the button is in an enabled state. Por defecto es true.

Al definir accessibilityLabel, asegúrese de que ha considerado las mejores prácticas de macOS.

Propiedades de la instancia​

Las siguientes propiedades están disponibles en las instancias de TouchBarButton:

touchBarButton.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.

touchBarButton.label​

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

touchBarButton.backgroundColor​

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

touchBarButton.icon​

Un NativeImage que representa el icono del botón actual. Changing this value immediately updates the button in the touch bar.

touchBarButton.iconPosition​

A string - Can be left, right or overlay. Por defecto es overlay.

touchBarButton.enabled​

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