Skip to content

UseListboxNavReturn

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

Properties

activeIndex

activeIndex: number

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

Currently active index, or -1 when none.


first()

first: () => void

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

Activate the first non-disabled item.

Returns

void


handleKeyDown()

handleKeyDown: (event) => boolean

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

Single keyboard handler for ArrowUp/Down/Home/End/Enter/Escape. Returns true when the event was handled (and preventDefault was called).

Parameters

event

KeyboardEvent | KeyboardEvent<Element>

Returns

boolean


last()

last: () => void

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

Activate the last non-disabled item.

Returns

void


navigableIndices: number[]

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

Snapshot of the navigable indices (non-disabled, in order).


next()

next: () => void

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

Move to the next non-disabled item.

Returns

void


prev()

prev: () => void

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

Move to the previous non-disabled item.

Returns

void


selectActive()

selectActive: () => void

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

Commit the active item via onSelect.

Returns

void


setActiveIndex()

setActiveIndex: (index) => void

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

Direct setter; the value is not validated.

Parameters

index

number

Returns

void