Skip to main content

Add an indicator icon on the status bar

This document outlines the basic features of working with Status Bar, including:


Adding a button on Status Bar

  1. Import the StatusBar module.

    const StatusBar = brackets.getModule("widgets/StatusBar");
  2. Register the command.

    Register the command that will trigger the clicking.

    var MY_COMMAND_ID = "helloworld_sayhello";
    CommandManager.register("Hello World", MY_COMMAND_ID, handleHelloWorld);
  3. Add the button to the StatusBar.

    To add the button to StatusBar, use addIndicator() :-

StatusBar.addIndicator(
MY_COMMAND_ID, // unique ID for this indicator
$("<div>Test</div>").click(handleHelloWorld), // Optional DOMNode for the indicator
true, // show the indicator
"hello-world-status", // CSS class
"tooltip", // tooltip text
);

→ The parameters of the addIndicator() method :-

ParamTypeDescription
idstringRegistration id of the indicator to be updated.
[indicator]DOMNode or jQueryObjectOptional DOMNode for the indicator
[visible]booleanShows or hides the indicator over the statusbar.
[style]stringSets the attribute "class" of the indicator.
[tooltip]stringSets the attribute "title" of the indicator.
[insertBefore]stringAn id of an existing status bar indicator. The new indicator will be inserted before (i.e. to the left of) the indicator specified by this parameter.

For a detailed description, refer to this link.