IGroupProvide

interface
Group & Selection

Runtime injection provided by a group component to all its item descendants — exposes registration, selection control, navigation and the full item list.

TypeScript

Definition

The TypeScript interface definition as found in the origam source. Click the copy icon to copy the snippet.

typescript

API

Properties

Every property declared by this interface, with its type, optionality and default.

register
required
(item: IGroupItem, cmp: ComponentInternalInstance) => void
Registers a new item in the group; called by each item on mount.
unregister
required
(id: number) => void
Removes an item from the group by its numeric id; called on unmount.
select
required
(id: number, value: boolean) => void
Sets the selected state of a specific item by id.
selected
required
Ref<Readonly<Array<number>>>
Reactive list of currently selected item ids.
isSelected
required
(id: number) => boolean
Returns true if the item with the given id is currently selected.
prev
required
() => number | undefined
Selects the previous item in registration order (wraps around).
next
required
() => number | undefined
Selects the next item in registration order (wraps around).
selectedClass
required
Ref<string | undefined>
CSS class applied to selected items, reactive to the group-level prop.
items
required
ComputedRef<Array<{ id: number value: unknown disabled: boolean | undefined domId?: string }>>
Computed list of all registered items with their id, value and disabled state.
disabled
required
Ref<boolean | undefined>
Whether the entire group is disabled.
getItemIndex
required
(value: unknown) => number
Returns the registration index of the item whose value matches the argument, or -1.

Usage

Examples

Ready-to-paste code snippets using this interface.

Injecting the group provide in an item component

typescript