Tooltip

Displays a tooltip that appears when hovering over an element.

Install

Run the following command to install the tooltip component:

npx acc-nuxt add Tooltip

Directions

Top

Bottom

Left

Top Left

Top Right

Bottom Left

Bottom Right

Top Start

Top End

Bottom Start

Bottom End

Side Alignments

Use left-start and right-start to align the tooltip's top edge with the trigger. The -end variants align their bottom edges.

Follow cursor

Disabled

Allow content hover

Custom styles

Props

direction:AccTooltipDirection— optional
default:top
The direction in which the tooltip should appear. Includes top, right, bottom, left, corner placements, and start/end aligned placements. left-start and right-start align the tooltip top with the trigger top; left-end and right-end align their bottom edges.
resize:boolean— optional
default:true
Whether the tooltip should adjust its position to stay within the viewport.
openDelay:number— optional
default:200
The delay in milliseconds before the tooltip appears when hovering over the trigger.
closeDelay:number— optional
default:100
The delay in milliseconds before the tooltip disappears when hovering over the trigger.
gap:number— optional
default:8
The gap in pixels between the tooltip and the trigger.
followCursor:boolean— optional
default:false
Whether the tooltip should follow the cursor position.
disabled:boolean— optional
default:false
Whether the tooltip should be disabled.
allowContentHover:boolean— optional
default:false
Whether the tooltip stays open while the content is hovered over.
tooltipClass:string— optional
default:undefined
Custom CSS class to apply to the tooltip content container.

Slots

The tooltip component provides the following slots for customization.

#trigger
The element that triggers the tooltip on hover. This is typically a button or any interactive element.
#content
The content displayed inside the tooltip popup.

CSS Variables

The tooltip component can be customized using the following CSS variables.

--lev-tooltip-bg
default:#ffffff
Background color of the tooltip.
--lev-tooltip-color
default:#141414
Text color of the tooltip content.
--lev-tooltip-border
default:1px solid #c3c6c7
Border style of the tooltip.
--lev-tooltip-shadow
default:0 1px 2px 0 rgba(0, 0, 0, 0.05)
Box shadow applied to the tooltip.
--lev-tooltip-padding
default:8px 12px
Padding inside the tooltip content.
--lev-tooltip-border-radius
default:4px
Border radius of the tooltip corners.
--lev-tooltip-z-index
default:1000
Z-index of the tooltip to control stacking order.