Skip to content

Class: Tooltip

Defined in: src/betterdiscord/ui/tooltip.ts:22

Constructors

Constructor

ts
new Tooltip(
   node: HTMLElement, 
   text: 
  | string
  | HTMLElement, 
   options: TooltipOptions): Tooltip;

Defined in: src/betterdiscord/ui/tooltip.ts:44

Creates a tooltip that shows when hovering over the given node.

Parameters

ParameterTypeDescription
nodeHTMLElementDOM node to monitor and show the tooltip on
text| string | HTMLElement-
optionsTooltipOptionsadditional options for the tooltip

Returns

Tooltip

Properties

active

ts
active: boolean;

Defined in: src/betterdiscord/ui/tooltip.ts:29


disabled

ts
disabled: boolean;

Defined in: src/betterdiscord/ui/tooltip.ts:28


element

ts
element: HTMLDivElement;

Defined in: src/betterdiscord/ui/tooltip.ts:30


label

ts
label: 
  | string
  | HTMLElement;

Defined in: src/betterdiscord/ui/tooltip.ts:24


labelElement

ts
labelElement: HTMLDivElement;

Defined in: src/betterdiscord/ui/tooltip.ts:32


node

ts
node: HTMLElement;

Defined in: src/betterdiscord/ui/tooltip.ts:23


observer?

ts
optional observer: MutationObserver;

Defined in: src/betterdiscord/ui/tooltip.ts:33


preventFlip

ts
preventFlip: boolean;

Defined in: src/betterdiscord/ui/tooltip.ts:27


side

ts
side: "top" | "right" | "bottom" | "left";

Defined in: src/betterdiscord/ui/tooltip.ts:26


style

ts
style: "warn" | "info" | "success" | "danger" | "primary";

Defined in: src/betterdiscord/ui/tooltip.ts:25


tooltipElement

ts
tooltipElement: HTMLDivElement;

Defined in: src/betterdiscord/ui/tooltip.ts:31

Accessors

canShowAbove

Get Signature

ts
get canShowAbove(): boolean;

Defined in: src/betterdiscord/ui/tooltip.ts:83

Boolean representing if the tooltip will fit on screen above the element

Returns

boolean


canShowBelow

Get Signature

ts
get canShowBelow(): boolean;

Defined in: src/betterdiscord/ui/tooltip.ts:85

Boolean representing if the tooltip will fit on screen below the element

Returns

boolean


canShowLeft

Get Signature

ts
get canShowLeft(): boolean;

Defined in: src/betterdiscord/ui/tooltip.ts:87

Boolean representing if the tooltip will fit on screen to the left of the element

Returns

boolean


canShowRight

Get Signature

ts
get canShowRight(): boolean;

Defined in: src/betterdiscord/ui/tooltip.ts:89

Boolean representing if the tooltip will fit on screen to the right of the element

Returns

boolean


container

Get Signature

ts
get container(): Element;

Defined in: src/betterdiscord/ui/tooltip.ts:81

Container where the tooltip will be appended.

Returns

Element

Methods

centerHorizontally()

ts
centerHorizontally(): void;

Defined in: src/betterdiscord/ui/tooltip.ts:173

Returns

void


centerVertically()

ts
centerVertically(): void;

Defined in: src/betterdiscord/ui/tooltip.ts:178

Returns

void


hide()

ts
hide(): void;

Defined in: src/betterdiscord/ui/tooltip.ts:92

Hides the tooltip. Automatically called on mouseleave.

Returns

void


show()

ts
show(): void;

Defined in: src/betterdiscord/ui/tooltip.ts:100

Shows the tooltip. Automatically called on mouseenter. Will attempt to flip if position was wrong.

Returns

void


showAbove()

ts
showAbove(): void;

Defined in: src/betterdiscord/ui/tooltip.ts:146

Force showing the tooltip above the node.

Returns

void


showBelow()

ts
showBelow(): void;

Defined in: src/betterdiscord/ui/tooltip.ts:153

Force showing the tooltip below the node.

Returns

void


showLeft()

ts
showLeft(): void;

Defined in: src/betterdiscord/ui/tooltip.ts:160

Force showing the tooltip to the left of the node.

Returns

void


showRight()

ts
showRight(): void;

Defined in: src/betterdiscord/ui/tooltip.ts:167

Force showing the tooltip to the right of the node.

Returns

void


create()

ts
static create(
   node: HTMLElement, 
   text: 
  | string
  | HTMLElement, 
   options: TooltipOptions): Tooltip;

Defined in: src/betterdiscord/ui/tooltip.ts:78

Alias for the constructor

Parameters

ParameterType
nodeHTMLElement
text| string | HTMLElement
optionsTooltipOptions

Returns

Tooltip