Skip to content

Topbar

Spicetify.Topbar.Button adds a button to the top bar, next to the navigation buttons or on the right side. In a v3 module, use registrar.placeButton('topbar-left', options) or 'topbar-right' from stdlib instead.

namespace Topbar {
class Button {
constructor(label: string, icon: SVGIcon | string, onClick: (self: Button) => void, disabled?: boolean, isRight?: boolean);
label: string;
icon: string;
onClick: (self: Button) => void;
disabled: boolean;
element: HTMLDivElement;
button: HTMLButtonElement;
tippy: any;
}
}
ParameterTypeDescription
labelstringThe tooltip and accessible label.
iconSVGIcon | stringAn icon name or SVG markup.
onClick(self: Button) => voidRuns when the user clicks the button.
disabledbooleanDisables the button. Defaults to false.
isRightbooleanPlaces the button on the right side of the top bar. Defaults to false.

The constructor adds the button to the top bar. Topbar.Button has no register or deregister, so remove the button with button.element.remove().

Setting label, icon, onClick or disabled updates the button. element is the wrapper div, and button is the button inside it. tippy is the Tippy.js instance that shows the label, styled with TippyProps. A disabled button receives no click events.

const lyricsButton = new Spicetify.Topbar.Button('Lyrics', 'lyrics', () => {
Spicetify.Platform.History.push('/lyrics-plus');
});
lyricsButton.label = 'Open lyrics';
lyricsButton.element.remove();