Skip to content

UseListboxNavOptions

Defined in: src/hooks/useListboxNav/useListboxNav.ts:7

Type Parameters

T

T

Properties

defaultActiveIndex?

optional defaultActiveIndex: number

Defined in: src/hooks/useListboxNav/useListboxNav.ts:18

Initial active index. Defaults to -1 (no active item).


isItemDisabled()?

optional isItemDisabled: (item, index) => boolean

Defined in: src/hooks/useListboxNav/useListboxNav.ts:15

Whether a given item should be skipped during navigation and rejected by selectActive().

Parameters

item

T

index

number

Returns

boolean


items

items: T[]

Defined in: src/hooks/useListboxNav/useListboxNav.ts:9

Items rendered in the listbox. The hook tracks navigation by index.


loop?

optional loop: boolean

Defined in: src/hooks/useListboxNav/useListboxNav.ts:24

Wrap from last → first (and vice versa) on next/prev.

Default

true

onEscape()?

optional onEscape: () => void

Defined in: src/hooks/useListboxNav/useListboxNav.ts:37

Called on Escape.

Returns

void


onSelect()?

optional onSelect: (item, index) => void

Defined in: src/hooks/useListboxNav/useListboxNav.ts:34

Called when the active item is committed via selectActive().

Parameters

item

T

index

number

Returns

void


resetOnItemsChange?

optional resetOnItemsChange: boolean

Defined in: src/hooks/useListboxNav/useListboxNav.ts:31

Reset the active index when the items array changes by reference. Useful for filtered listboxes where the previous index would be stale.

Default

true