Skip to content
Porcelana

Tooltip & InfoTip

Hover/focus hints, and a tap-to-open InfoTip for touch screens.

Example

Snooze length
Example.tsx
import { IconButton, InfoTip, Tooltip } from "@porcelana/ui";
import { SunIcon } from "@porcelana/icons";

export default function Example() {
  return (
    <div style={{ display: "flex", alignItems: "center", gap: 16 }}>
      <Tooltip content="Ring at sunrise">
        <IconButton aria-label="Sunrise alarm">
          <SunIcon size={20} />
        </IconButton>
      </Tooltip>
      <span>Snooze length</span>
      <InfoTip label="About snooze">Snooze repeats the alarm every 9 minutes until you turn it off.</InfoTip>
    </div>
  );
}

Import

Import
import { Tooltip, InfoTip } from "@porcelana/ui";
import "@porcelana/ui/styles.css"; // once, at your app root

Props

Generated from the TypeScript types. Standard HTML attributes are passed through and not listed.

Tooltip

Hover/focus tooltip. Touch screens have no hover: for information people must be able to reach on a phone, use `InfoTip` (tap to open) instead.

PropTypeDefaultDescription
contentrequiredReactNode–Tooltip text. Supplements the trigger's name; never the only label.
defaultOpenboolean–Initial open state when uncontrolled.
delayDurationnumber300Hover delay before showing, in ms.
onOpenChange((open: boolean) => void)–Called when the open state changes.
openboolean–Controlled open state. Use with onOpenChange.
side"top" | "right" | "bottom" | "left"topPreferred side of the trigger to render on.

InfoTip

PropTypeDefaultDescription
labelrequiredstring–Accessible name of the trigger, e.g. "About snooze".
side"top" | "right" | "bottom" | "left"topPreferred side of the trigger to render on.

Accessibility

  • Tooltip shows on hover and keyboard focus and describes its trigger.
  • Never put the only label of a control in a tooltip.

Mobile

  • Touch screens have no hover, so Tooltip won't appear there. Use InfoTip for anything people need to read on a phone.