Skip to content

@pgege/kaboo-react


Interface: ReferenceProvider\<T>

Defined in: src/references/types.ts:97

A pluggable entry in the @ reference menu. File upload ships as a built-in provider (see uploadProvider); apps register their own for entities/actions (tables, dashboards, tickets, …).

A provider is either searchable (supplies search so its items list live in the menu) or action-only (omits search; selecting its group row runs onSelect, e.g. opening a file picker).

Extended by

Type Parameters

T

T = unknown

Properties

icon?

optional icon?: ReactNode

Defined in: src/references/types.ts:103

Optional icon rendered beside the group heading.


id

id: string

Defined in: src/references/types.ts:99

Stable provider id, e.g. "upload" | "table" | "dashboard".


label

label: string

Defined in: src/references/types.ts:101

Group heading shown in the @ menu.


onSelect?

optional onSelect?: (item) => void | Promise\<void>

Defined in: src/references/types.ts:115

Side effect when an item (or the action-only group row) is chosen, e.g. opening a file dialog or running an action. Called before toReference.

Parameters

item

ReferenceItem\<T>

Returns

void | Promise\<void>


renderItem?

optional renderItem?: (item) => ReactNode

Defined in: src/references/types.ts:110

Custom row renderer; falls back to label + description.

Parameters

item

ReferenceItem\<T>

Returns

ReactNode


optional search?: (query) => ReferenceItem\<T>[] | Promise\<ReferenceItem\<T>[]>

Defined in: src/references/types.ts:108

Return the items to list for the current query. Omit for an action-only provider (its group row triggers onSelect directly).

Parameters

query

string

Returns

ReferenceItem\<T>[] | Promise\<ReferenceItem\<T>[]>


toReference?

optional toReference?: (item) => PendingReference

Defined in: src/references/types.ts:120

How a chosen item serializes onto the message. Omit for pure actions that produce their reference asynchronously (e.g. upload, via its own callback).

Parameters

item

ReferenceItem\<T>

Returns

PendingReference