Tooltip

A tooltip that swells out of nothing above its trigger.

Installation#

pnpmnpmyarnbun
$ pnpm dlx shadcn@latest add @liquikit/tooltip

Needs the @liquikit registry in your components.json. Set it up once.

Usage#

import { Tooltip } from "@/components/liquikit/tooltip"
<Tooltip.Provider>
  <Tooltip.Root>
    <Tooltip.Trigger icon aria-label="Share">…</Tooltip.Trigger>
    <Tooltip.Popup>Share</Tooltip.Popup>
  </Tooltip.Root>
</Tooltip.Provider>

Tooltip.Provider lets tooltips next to each other open instantly once one has opened. Tooltip.Trigger is a glass button.

API Reference#

Tooltip.Root

PropTypeDefault
openboolean

Whether the popup is open. Pair it with onOpenChange to control it.

—

Also takes every prop of Base UI's tooltip, plus className and style.

Tooltip.Popup

PropTypeDefault
sideBaseTooltip.Positioner.Props["side"]

Which side of the trigger the popup opens on.

"top"
sideOffsetnumber

Gap between the trigger and the popup, in pixels.

8
theme"light" | "dark"

Light or dark glass. Falls back to the nearest GlassThemeProvider, then light.

—
refraction"interactive" | "always"

When the glass bends the page. interactive bends it while the component is pressed, dragged or focused, always bends it all the time.

"interactive"
childrenReactNode

The content.

—

Also takes every prop of Base UI's tooltip, plus className and style.