# HoverData

Import from `@pibbl/core/viz`. Evaluates an ordinary synchronous query and renders its typed result.

`query(context)` reads current signals and `context.scale(id)` snapshots. Its synchronous result (including undefined) goes to `children(result)`. Callbacks cannot call hooks or write signals; return components for hooks. Query function identity does not determine child identity. The context cannot be retained.

## API details from source

<span id="api-HoverData"></span>

### HoverData

Evaluates an ordinary synchronous query under the current scale scope.

```ts
HoverData: <T>({ query, children }: HoverDataProps<T>) => PibblNode
```

Related API: [HoverData](/reference/components/hover-data/), [HoverDataProps](/reference/components/hover-data/), [PibblNode](/reference/types/elements-components/#pibblnode).

#### Parameters

- **`props`** — Hover query and child renderer receiving its result. See [HoverDataProps](/reference/components/hover-data/).

#### Returns

Content rendered from the current hover query result. See [PibblNode](/reference/types/elements-components/#pibblnode).

#### See also

[HoverDataProps](/reference/components/hover-data/)

[PibblNode](/reference/types/elements-components/#pibblnode)

[View source — packages/core/src/features/viz/lib/hover-data.tsx:15](/source/packages/core/src/features/viz/lib/hover-data-tsx/#L15)

<span id="api-HoverQueryContext"></span>

### HoverQueryContext

Scale lookup context supplied when evaluating a hover query.

```ts
interface HoverQueryContext
```

Related API: [HoverQueryContext](/reference/components/hover-data/).

#### See also

[ScaleId](/reference/components/scale/)

[ResolvedContinuousScale](/reference/functions/utc-domains/)

[HoverQuery](/reference/components/hover-data/)

[View source — packages/core/src/features/viz/lib/hover-types.ts:13](/source/packages/core/src/features/viz/lib/hover-types-ts/#L13)

#### Properties and methods

<span id="api-HoverQueryContext-scale"></span>
<details>
<summary>scale</summary>


```ts
scale: (id: ScaleId) => ResolvedContinuousScale
```

Related API: [ScaleId](/reference/components/scale/), [ResolvedContinuousScale](/reference/functions/utc-domains/).

Looks up a resolved continuous scale by its identifier. See ResolvedContinuousScale.

##### Parameters

- **`id`** — Identity of the scale needed by the query. See [ScaleId](/reference/components/scale/).

##### Returns

The resolved continuous scale. See [ResolvedContinuousScale](/reference/functions/utc-domains/).

[View source — packages/core/src/features/viz/lib/hover-types.ts:19](/source/packages/core/src/features/viz/lib/hover-types-ts/#L19)

</details>

<span id="api-HoverQuery"></span>

### HoverQuery

A query that resolves reactive hover input into a hit or no result.

```ts
type HoverQuery<T> = (context: HoverQueryContext) => T | undefined
```

Related API: [HoverQuery](/reference/components/hover-data/), [HoverQueryContext](/reference/components/hover-data/).

#### Parameters

- **`context`** — Pointer position and scale lookup for this query. See [HoverQueryContext](/reference/components/hover-data/).

#### Returns

The current match, or undefined when there is no match.

#### See also

[HoverQueryContext](/reference/components/hover-data/)

[HoverDataProps](/reference/components/hover-data/)

[closestPoint](/reference/functions/closest-point/)

[View source — packages/core/src/features/viz/lib/hover-types.ts:32](/source/packages/core/src/features/viz/lib/hover-types-ts/#L32)

<span id="api-HoverDataProps"></span>

### HoverDataProps

Authored inputs for HoverData, including the declared data and presentation options.

```ts
interface HoverDataProps<T>
```

Related API: [HoverDataProps](/reference/components/hover-data/).

#### See also

[HoverQuery](/reference/components/hover-data/)

[PibblNode](/reference/types/elements-components/#pibblnode)

[HoverData](/reference/components/hover-data/)

[View source — packages/core/src/features/viz/lib/hover-types.ts:40](/source/packages/core/src/features/viz/lib/hover-types-ts/#L40)

#### Properties and methods

<span id="api-HoverDataProps-query"></span>
<details>
<summary>query</summary>


```ts
readonly query: HoverQuery<T> & (T extends PromiseLike<unknown> ? never : unknown)
```

Related API: [HoverQuery](/reference/components/hover-data/).

Query that selects a style rule or resolves a hover result. See HoverQuery.

[View source — packages/core/src/features/viz/lib/hover-types.ts:42](/source/packages/core/src/features/viz/lib/hover-types-ts/#L42)

</details>

<span id="api-HoverDataProps-children"></span>
<details>
<summary>children</summary>


```ts
readonly children: (result: T | undefined) => PibblNode
```

Related API: [PibblNode](/reference/types/elements-components/#pibblnode).

Descendant content or the callback that supplies it. See PibblNode.

##### Parameters

- **`result`** — Current query match, or undefined when there is no match.

##### Returns

Pibbl content to render for the hover state. See [PibblNode](/reference/types/elements-components/#pibblnode).

[View source — packages/core/src/features/viz/lib/hover-types.ts:48](/source/packages/core/src/features/viz/lib/hover-types-ts/#L48)

</details>

## Implementation guidance for agents

Read the [Authoring, signals, and lifecycle companion](/agents/topics/lifecycle/) for ownership, adaptation, failure modes, and verification. [Agent start](/agents/) provides the version-selection workflow.

## Complete minimal examples

- [Hover inspection card](/minimal-examples/viz/hover-card/): Display a measured point in a bounded hover card. [Plain source](/minimal/viz/hover-card.tsx)
- [Hover query helpers](/minimal-examples/viz/hover-queries/): Run closest-point, closest-x, and interpolated-x queries against a scale context. [Plain source](/minimal/viz/hover-queries.ts)
## Documentation version

Documentation built with @pibbl/core 0.0.2, revision 272a94a. ALPHA — NOT FOR PRODUCTION USE.
