vael-ui v0.5.7

Directives

v-tooltip

Shows a tooltip on hover and keyboard focus. Every v-tooltip in the app shares one <TooltipHost />, which you mount near your app root (see the Global Setup guide). Style every tooltip through the ui prop of TooltipHost, or one through its ui option; --ui-tooltip-bg and --ui-tooltip-color set the colours. The Vapor build exports its own version under the same name from vael-ui/vapor.

Install

import { vTooltip } from 'vael-ui'

Examples

Value

NameTypeDescription
stringstringThe tooltip text, shorthand for { content }.
contentstring | ComponentThe tooltip text, or a component for markup such as a status dot or a progress bar. Required in both forms. A component is drawn in the same shared tooltip, so it still opens at once and glides between targets.
propsRecord<string, unknown>The props for a content component: { content: ProjectTip, props: { project } }.
followbooleanWhile open, the tooltip follows a mouse or pen along the target, and stops at its ends: for a wide target, such as a timeline bar. Opened from the keyboard, it stays centred. Touch keeps its long press.
side'top' | 'bottom' | 'left' | 'right'The side of the target to open on. You can also set it with a modifier.
alignAlign
sideOffsetnumber | (() => number)The gap between the target and the tooltip, in px. Default 8. A function is read each time the tooltip is positioned, for a target whose size is still changing, such as a magnifying Dock item.
openDelay / closeDelaynumberThe wait before the tooltip opens or closes, in ms.
keysstring[]A shortcut's keys, shown after the text as Kbd elements: { content: 'Search', keys: ['⌘', 'K'] }.
beforeCloseBeforeCloseThis target's own close guard, in place of TooltipHost's beforeClose. One host serves every target, so this is how you set a guard per target.
forceMountbooleanOverrides TooltipHost's forceMount prop for this target.
uiPartial<{ positioner: UiPartValue; panel: UiPartValue }>Class and style for this target's tooltip, in place of TooltipHost's ui for each part you name. Set --ui-tooltip-bg and --ui-tooltip-color on panel to recolour it.

Modifiers

NameTypeDescription
.top / .bottom / .left / .right—Sets side when the value doesn't set it.