Tooltip
Tooltip adds short explanatory text to compact controls.
@duskmoon-dev/components/tooltipUsage
When to use
- Use it when supporting content should stay attached to a trigger or task context.
- Prefer controlled open state when the surrounding workflow needs to react to dismissal.
Implementation notes
Features
Documents trigger, placement, and open-state patterns for content rendered above the page.
Highlights controlled state and close callbacks where overlays expose them.
Tooltip is most often configured through `title`, `placement`, `open`, `defaultOpen`.
Renders child content
Feature Demos
Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.
Tooltip is closed.
Native interest hint
Hover or focus the native button to show a brief noninteractive description. The browser controls hint visibility; the status reflects actual onOpenChange callbacks. Requires browser support for Interest Invokers, hint popovers and CSS Anchor Positioning.
Source
import React, { useState } from "react";
import "@duskmoon-dev/components/styles.css";
import { Tooltip } from "@duskmoon-dev/components/tooltip";
export function TooltipInterestPreview() {
const [open, setOpen] = useState(false);
return (
<div data-overlay-tooltip-demo style={{ display: "grid", gap: "0.75rem", justifyItems: "start" }}>
<Tooltip
title="Review the project settings before publishing."
onOpenChange={setOpen}
>
<button className="btn btn-outlined" type="button">Review settings</button>
</Tooltip>
<p role="status" aria-atomic="true">Tooltip is {open ? "open" : "closed"}.</p>
</div>
);
}API
The API reference below lists every parsed exported type or interface for Tooltip. Start with `title`, `placement`, `open`, `defaultOpen` for common usage.
packages/components/src/components/tooltip/Tooltip.types.tsScenarios: packages/components/src/components/tooltip/Tooltip.test.tsx| Prop | Type | Required | Description |
|---|---|---|---|
title | ReactNode | No | title configures Tooltip. |
placement | TooltipPlacement | No | placement configures Tooltip. |
open | boolean | No | open configures Tooltip. |
defaultOpen | boolean | No | defaultOpen configures Tooltip. |
onOpenChange | (open: boolean) => void | No | Called when native interest changes visibility, or a controlled interaction requests it. Controlled tooltips use manual popovers and stay open until `open` changes. |
arrow | boolean | No | @deprecated Native tooltips follow Core's arrowless automatic placement. |
size | TooltipSize | No | size configures Tooltip. |
children | ReactNode | Yes | children configures Tooltip. |
Type definition
"top" | "bottom" | "left" | "right"Type definition
"sm" | "md" | "lg"