DocsAPI referenceUI machinestooltip

tooltip machine

The public state machine contract for @grassroot/ui-machines/tooltip. The machine owns behaviour; the matching headless layer owns composition.

@grassroot/ui-machines/tooltip

Package

12 exports
View source packages/ui-machines/src/tooltip/index.ts

Service example

tooltip.tsts
import { createService } from "@grassroot/statechart";
import { tooltipMachine } from "@grassroot/ui-machines/tooltip";
const service = createService(tooltipMachine, { input: {} });
service.start();
service.send({ type: "…" });
service.stop();

Exports

DeclarationView source
TooltipChangeReasonts
type TooltipChangeReason = "pointer" | "focus" | "escape" | "delay" | "programmatic";
DeclarationView source
TooltipCommandts
type TooltipCommand = (CommandObject & {
readonly type: "OPEN_CHANGE_REQUEST";
readonly open: boolean;
readonly reason: TooltipChangeReason;
}) | ScheduleCommand<TooltipEvent> | CancelCommand;
DeclarationView source
TooltipContextts
type TooltipContext = {
readonly mode: "controlled" | "uncontrolled";
};
Name
Kind
Type
Requirement
mode
property
"controlled" | "uncontrolled"
required
Name
mode
Kind
property
Type
"controlled" | "uncontrolled"
Requirement
required
DeclarationView source
TooltipDiagnosticCodests
export declare const TooltipDiagnosticCodes: readonly DiagnosticCatalogueEntry[];
DeclarationView source
TooltipEventts
type TooltipEvent = {
readonly type: "POINTER_ENTER";
} | {
readonly type: "POINTER_LEAVE";
} | {
readonly type: "FOCUS";
} | {
readonly type: "BLUR";
} | {
readonly type: "ESCAPE";
} | {
readonly type: "OPEN";
readonly reason: TooltipChangeReason;
} | {
readonly type: "CLOSE";
readonly reason: TooltipChangeReason;
};
DeclarationView source
TooltipInputts
type TooltipInput = {
/** Controlled committed open state. Defining it fixes controlled mode at first start. */
readonly open?: boolean;
/** Uncontrolled initial open state. */
readonly defaultOpen?: boolean;
/** Delay before an uncontested POINTER_ENTER opens. Default 0 (legacy immediate). */
readonly openDelayMs?: number;
/** Delay before an uncontested POINTER_LEAVE closes. Default 0 (legacy immediate). */
readonly closeDelayMs?: number;
readonly disabled?: boolean;
/** Headless-layer styling hook only — the machine never branches on it. */
readonly side?: "top" | "bottom";
};
Name
Kind
Type
Requirement
Description
closeDelayMs
property
number
optional
Delay before an uncontested POINTER_LEAVE closes. Default 0 (legacy immediate).
defaultOpen
property
boolean
optional
Uncontrolled initial open state.
disabled
property
boolean
optional
open
property
boolean
optional
Controlled committed open state. Defining it fixes controlled mode at first start.
openDelayMs
property
number
optional
Delay before an uncontested POINTER_ENTER opens. Default 0 (legacy immediate).
side
property
"top" | "bottom"
optional
Headless-layer styling hook only — the machine never branches on it.
Name
closeDelayMs
Kind
property
Type
number
Requirement
optional
Description
Delay before an uncontested POINTER_LEAVE closes. Default 0 (legacy immediate).
Name
defaultOpen
Kind
property
Type
boolean
Requirement
optional
Description
Uncontrolled initial open state.
Name
disabled
Kind
property
Type
boolean
Requirement
optional
Description
Name
open
Kind
property
Type
boolean
Requirement
optional
Description
Controlled committed open state. Defining it fixes controlled mode at first start.
Name
openDelayMs
Kind
property
Type
number
Requirement
optional
Description
Delay before an uncontested POINTER_ENTER opens. Default 0 (legacy immediate).
Name
side
Kind
property
Type
"top" | "bottom"
Requirement
optional
Description
Headless-layer styling hook only — the machine never branches on it.
DeclarationView source
tooltipMachinets
export declare const tooltipMachine: TooltipMachine;
DeclarationView source
TooltipMachinets
type TooltipMachine = Machine<TooltipInput, TooltipStateValue, TooltipContext, TooltipEvent, TooltipCommand>;
DeclarationView source
tooltipReplaySequencets
export declare const tooltipReplaySequence: readonly TooltipEvent[];
DeclarationView source
tooltipSelectorsts
export declare const tooltipSelectors: {
open: (snapshot: TooltipSnapshot) => boolean;
};
Name
Kind
Type
Requirement
open
property
(snapshot: TooltipSnapshot) => boolean
required
Name
open
Kind
property
Type
(snapshot: TooltipSnapshot) => boolean
Requirement
required
DeclarationView source
TooltipSnapshotts
type TooltipSnapshot = Snapshot<TooltipStateValue, TooltipContext>;
DeclarationView source
TooltipStateValuets
type TooltipStateValue = "open" | "closed";