API: Core
findRelativeItem
Next/previous enabled item relative to activeId.
Overview
Next/previous enabled item relative to activeId. If activeId is itself disabled (or
was disabled in place), movement starts from its position, so the neighbour in the requested
direction is chosen rather than jumping to an end. Unknown/null ids start from the first
(forward) or last (backward) enabled item.
- Kind: Function
- Source: packages/core/src/collection/collection.ts:236
Signature
function findRelativeItem<T extends CollectionItem>(items: readonly T[], activeId: string | null, direction: 1 | -1, options?: { wrap?: boolean; }): CollectionNavigationResult<T>
| Parameter | Type | Optional | Description |
|---|---|---|---|
items |
readonly T[] |
||
activeId |
string | null |
||
direction |
1 | -1 |
||
options |
{ wrap?: boolean } |
Yes |
Returns CollectionNavigationResult<T>