Tooltip

A popup that displays additonal information when hovering or focusing an element.

Preview
Code

Basic Example

<script>
	import { Tooltip, TooltipArrow, TooltipContent, TooltipTrigger } from 'lithesome';
</script>

<Tooltip>
	<TooltipTrigger>Hover me</TooltipTrigger>
	<TooltipContent>
		<TooltipArrow />
		Howdy!
	</TooltipContent>
</Tooltip>

API Reference

<Tooltip />

PropertyTypeDescription
delay number | [ number, number ]

The delay in `ms` in which it will take for the content show. Passing a number will set both in and out delays.\ Passing an array of two indexes will apply the `[in, out]` delays.

children Snippet<[ S extends Record<string, any> ? S : never ]>

The default snippet to render.

visible boolean

The current visibility of the contents.

disabled boolean

Disables the entire component tree.

portalTarget HTMLElement | string

The DOM target to mount the content to.

floatingConfig FloatingConfig

The underlying FloatingUI config.

StateTypeDescription
visiblebooleanTrue if the contents are visible.

<TooltipTrigger />

PropertyTypeDescription
ref E

The reference to the underlying element.

children Snippet<[ S extends Record<string, any> ? S : never ]>

The default snippet to render.

custom Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]>

Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it.

StateTypeDescription
visiblebooleanTrue if the contents are visible.

<TooltipContent />

PropertyTypeDescription
ref E

The reference to the underlying element.

children Snippet<[ S extends Record<string, any> ? S : never ]>

The default snippet to render.

custom Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]>

Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it.

StateTypeDescription
visiblebooleanTrue if the contents are visible.

<TooltipArrow />

PropertyTypeDescription
ref E

The reference to the underlying element.

children Snippet<[ S extends Record<string, any> ? S : never ]>

The default snippet to render.

custom Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]>

Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it.

StateTypeDescription
visiblebooleanTrue if the contents are visible.