WlTooltip
Placement
Focus or hover shows the tooltip; Escape hides it without moving focus. A disabled trigger needs a focusable wrapper.
Full example
<script setup lang="ts">
import { WlButton, WlTooltip } from "legato-ui";
import { ref } from "vue";
const visible = ref(false);
</script>
<template>
<div class="wl-stack" data-space="md" data-review-example="WlTooltip">
<div class="wl-inline" data-space="md">
<WlTooltip v-model:visible="visible" >
<WlButton size="sm">{{ "Save details" }}</WlButton>
<template #content><strong>{{ "Changes are saved automatically." }}</strong></template>
</WlTooltip>
<WlTooltip content="This action requires editor access.">
<WlButton size="sm" disabled>{{ "Delete (unavailable)" }}</WlButton>
</WlTooltip>
<WlButton size="sm" @click="visible = !visible">{{ "Toggle tooltip" }}</WlButton>
</div>
<p class="wl-text-small">{{ "Focus or hover shows the tooltip; Escape hides it without moving focus. A disabled trigger needs a focusable wrapper." }}</p>
</div>
</template>Behavior
Focus or hover shows the tooltip; Escape hides it without moving focus. A disabled trigger needs a focusable wrapper.
Full example
<script setup lang="ts">
import { WlButton, WlTooltip } from "legato-ui";
import { ref } from "vue";
const visible = ref(false);
</script>
<template>
<div class="wl-stack" data-space="md" data-review-example="WlTooltip">
<div class="wl-inline" data-space="md">
<WlTooltip v-model:visible="visible" >
<WlButton size="sm">{{ "Save details" }}</WlButton>
<template #content><strong>{{ "Changes are saved automatically." }}</strong></template>
</WlTooltip>
<WlTooltip content="This action requires editor access.">
<WlButton size="sm" disabled>{{ "Delete (unavailable)" }}</WlButton>
</WlTooltip>
<WlButton size="sm" @click="visible = !visible">{{ "Toggle tooltip" }}</WlButton>
</div>
<p class="wl-text-small">{{ "Focus or hover shows the tooltip; Escape hides it without moving focus. A disabled trigger needs a focusable wrapper." }}</p>
</div>
</template>Descriptions on hover and focus
Descriptive hover and focus content with an optional controlled visibility model.
Focus or hover shows the tooltip; Escape hides it without moving focus. A disabled trigger needs a focusable wrapper.
Full example
<script setup lang="ts">
import { WlButton, WlTooltip } from "legato-ui";
import { ref } from "vue";
const visible = ref(false);
</script>
<template>
<div class="wl-stack" data-space="md" data-review-example="WlTooltip">
<div class="wl-inline" data-space="md">
<WlTooltip v-model:visible="visible" >
<WlButton size="sm">{{ "Save details" }}</WlButton>
<template #content><strong>{{ "Changes are saved automatically." }}</strong></template>
</WlTooltip>
<WlTooltip content="This action requires editor access.">
<WlButton size="sm" disabled>{{ "Delete (unavailable)" }}</WlButton>
</WlTooltip>
<WlButton size="sm" @click="visible = !visible">{{ "Toggle tooltip" }}</WlButton>
</div>
<p class="wl-text-small">{{ "Focus or hover shows the tooltip; Escape hides it without moving focus. A disabled trigger needs a focusable wrapper." }}</p>
</div>
</template>Props
Types, accepted values and literal defaults come from the public manifest. Inherited settings name their source; “Not set” means no default is declared.
v-model:visible: booleanWhether the surface is open.
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
content | string | Not set | Tooltip text when the content slot is not supplied. |
placement | WlPopoverPlacement | "top" | Preferred overlay side relative to its anchor. |
showDelay | number | 0 | Delay in milliseconds before showing the tooltip. |
hideDelay | number | 100 | Delay in milliseconds before hiding the tooltip. |
disabled | boolean | false | Disable user interaction with this component. |
motion | boolean | Inherits WlConfig.motion | Enable motion locally, with application defaults and reduced-motion preferences respected. |
pt | WlPt< | Not set | Attributes and callbacks for the component's documented pass-through sections. |
Events
| Event | Payload | When emitted |
|---|---|---|
update:visible | boolean | Whether the surface is open. |
Slots
| Slot | Type / values | Content |
|---|---|---|
default | default?(props: { visible: boolean; show: () => void; hide: () => void }): unknown; | Tooltip trigger content with visibility and explicit show/hide actions. |
content | content?(props: Record< | Formatted descriptive tooltip content; interactive controls belong in a popover. |
Pass-through: pt
Sections WlTooltip are listed below. Attributes merge in this order: createWlPt() WlConfig.ptpt instance. Class and style merge; the last supplied value takes priority for other attributes.
| Section | DOM | Purpose |
|---|---|---|
trigger | span.wl-tooltip-component__trigger | Element that opens the tooltip. |
root | span.wl-tooltip | Main element of the component. |
text | span.wl-tooltip__text | Text content of the component. |
arrow | span.wl-tooltip__arrow | Decorative arrow pointing to the trigger. |
Sections refer to the component DOM. Dotted names identify a configuration group and its section; composite parts use their own pt groups. Global and local attributes merge, with class and style added together.
Keyboard and accessibility
- Keep the trigger action named independently: a tooltip adds a description.
- A role=tooltip region is connected through aria-describedby without replacing existing descriptions. Content stays non-interactive.
- Focus or hover shows the tooltip; Escape hides it without moving focus. A disabled trigger needs a focusable wrapper.
Keyboard and application responsibilities
| Key | Action |
|---|---|
| Tab / focus | Show the description for the focused trigger. |
| Escape | Hide the tooltip without moving focus. |
Provide a meaningful accessible name and connect labels, hints and errors to the focusable element. Check the behavior with your own data and a screen reader.
WAI-ARIA Authoring PracticesChanges are emitted through v-model:visible. After selection, cancellation and reset, labels and states must remain clear.
In your application, check keyboard controls, zoom and focus visibility. State labels and required information must be readable in every theme.