Class: UIButton

UIButton

An abstract class representing a UI button with customizable functionality. It can display an icon and handle a click event with a custom callback.

new UIButton(isActive, svgIcon)

UIMap/UIDisplay/UIButton/index.ts, line 5

Creates an instance of UIButton.

Name Type Default Description
isActive boolean false

Determines if the button is active (default is false).

svgIcon string

The SVG icon to display on the button.

Methods

createTooltip(title)

UIMap/UIDisplay/UIButton/index.ts, line 93

Creates tooltip to the button.

Name Type Description
title string

The tooltip text to display when the user hovers over the button, don't use with setTitle

getSVG(){string}

UIMap/UIDisplay/UIButton/index.ts, line 54

Gets the SVG icon of the button.

Returns:
Type Description
string The SVG icon string of the button.

hasTooltip()

UIMap/UIDisplay/UIButton/index.ts, line 114

Return true if Button has tooltip, false in other case.

refreshTitleTranlations()

UIMap/UIDisplay/UIButton/index.ts, line 157

Updates the translated title and tooltip of the button.

removeTitle()

UIMap/UIDisplay/UIButton/index.ts, line 82

Removes the title from the button.

removeTooltip()

UIMap/UIDisplay/UIButton/index.ts, line 104

Remove tooltip from the button.

setClassName(className)

UIMap/UIDisplay/UIButton/index.ts, line 123

Sets the title of the button.

Name Type Description
className string

The tooltip text to display when the user hovers over the button.

setOnClick(callback)

UIMap/UIDisplay/UIButton/index.ts, line 63

Sets the callback function that will be triggered when the button is clicked.

Name Type Description
callback function

The function to execute on button click.

setSVG(){void}

UIMap/UIDisplay/UIButton/index.ts, line 45

Sets the SVG icon of the button.

Returns:
Type Description
void

setTitle(title)

UIMap/UIDisplay/UIButton/index.ts, line 72

Sets the title of the button.

Name Type Description
title string

The tooltip text to display when the user hovers over the button.

showIfActive(container)

UIMap/UIDisplay/UIButton/index.ts, line 140

Displays the button in the specified container if the button is active. Adds an event listener for the button's click event that triggers the assigned callback function.

Name Type Description
container HTMLElement

The container element to append the button to.