- Name
mode- Kind
- property
- Type
"controlled" | "uncontrolled"- Requirement
- required
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
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();12 of 12
Exports
TooltipChangeReason
typeTooltipChangeReasonts
type TooltipChangeReason = "pointer" | "focus" | "escape" | "delay" | "programmatic";TooltipCommand
typeTooltipCommandts
type TooltipCommand = (CommandObject & { readonly type: "OPEN_CHANGE_REQUEST"; readonly open: boolean; readonly reason: TooltipChangeReason;}) | ScheduleCommand<TooltipEvent> | CancelCommand;TooltipContext
typeTooltipContextts
type TooltipContext = { readonly mode: "controlled" | "uncontrolled";};Name
Kind
Type
Requirement
modeproperty
"controlled" | "uncontrolled"required
TooltipDiagnosticCodes
valueTooltipDiagnosticCodests
export declare const TooltipDiagnosticCodes: readonly DiagnosticCatalogueEntry[];TooltipEvent
typeTooltipEventts
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;};TooltipInput
typeTooltipInputts
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
closeDelayMsproperty
numberoptional
Delay before an uncontested POINTER_LEAVE closes. Default 0 (legacy immediate).
defaultOpenproperty
booleanoptional
Uncontrolled initial open state.
disabledproperty
booleanoptional
—
openproperty
booleanoptional
Controlled committed open state. Defining it fixes controlled mode at first start.
openDelayMsproperty
numberoptional
Delay before an uncontested POINTER_ENTER opens. Default 0 (legacy immediate).
sideproperty
"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.
tooltipMachine
valuetooltipMachinets
export declare const tooltipMachine: TooltipMachine;TooltipMachine
typeTooltipMachinets
type TooltipMachine = Machine<TooltipInput, TooltipStateValue, TooltipContext, TooltipEvent, TooltipCommand>;tooltipReplaySequence
valuetooltipReplaySequencets
export declare const tooltipReplaySequence: readonly TooltipEvent[];tooltipSelectors
valuetooltipSelectorsts
export declare const tooltipSelectors: { open: (snapshot: TooltipSnapshot) => boolean;};Name
Kind
Type
Requirement
openproperty
(snapshot: TooltipSnapshot) => booleanrequired
- Name
open- Kind
- property
- Type
(snapshot: TooltipSnapshot) => boolean- Requirement
- required
TooltipSnapshot
typeTooltipSnapshotts
type TooltipSnapshot = Snapshot<TooltipStateValue, TooltipContext>;TooltipStateValue
typeTooltipStateValuets
type TooltipStateValue = "open" | "closed";