Files
risuai/src/ts/gui/tooltip.ts
2023-07-22 20:45:27 +09:00

32 lines
701 B
TypeScript

import tippy from 'tippy.js'
import 'tippy.js/dist/tippy.css';
import 'tippy.js/themes/translucent.css';
export function tooltip(node:HTMLElement, tip:string) {
const instance = tippy(node, {
content: tip,
animation: 'fade',
arrow: true,
theme: 'translucent',
})
return {
destroy() {
instance.destroy()
}
};
}
export function tooltipRight(node:HTMLElement, tip:string) {
const instance = tippy(node, {
content: tip,
animation: 'fade',
arrow: true,
placement: 'right',
theme: 'translucent',
})
return {
destroy() {
instance.destroy()
}
};
}