Summary
Add a lightweight tooltip directive for hover hints — no library needed.
Usage
<button x-tooltip="Save your changes">Save</button>
<button x-tooltip.bottom="Delete this item" x-tooltip.type="warning">Delete</button>
<!-- Or with the composable -->
<script client>
const tooltipRef = useRef('myBtn')
useTooltip(tooltipRef, 'Tooltip text', { position: 'top' })
</script>API
x-tooltip directive
x-tooltip="text"— top position (default)x-tooltip.top/x-tooltip.bottom/x-tooltip.left/x-tooltip.rightx-tooltip.delay="500"— show delay in ms
useTooltip() composable
useTooltip(ref: RefObject, text: string, options?: {
position?: 'top' | 'bottom' | 'left' | 'right'
delay?: number
}): voidImplementation
- Process
x-tooltipin the signals runtime (alongside x-model, x-class etc.) - Single shared tooltip element, repositioned on hover
- CSS arrow pointer
- Dark mode support
- Fade in/out animation