- Name
service- Kind
- parameter
- Type
SelectionService- Requirement
- required
DocsAPI referenceHeadlessselection
selection headless API
The core connector and vanilla mount are always visible. Use the framework choice to inspect native composition, props, outputs, context and hooks for the selected adapter.
26 of 26
@grassroot/ui-headless-core/selection
Core connector and vanilla API
connectSelection
functionconnectSelectionts
declare function connectSelection(service: SelectionService, scope: PartScope, options?: SelectionConnectOptions): SelectionApi;Name
Kind
Type
Requirement
serviceparameter
SelectionServicerequired
scopeparameter
PartScoperequired
optionsparameter
SelectionConnectOptionsoptional
returnreturn value
SelectionApin/a
- Name
scope- Kind
- parameter
- Type
PartScope- Requirement
- required
- Name
options- Kind
- parameter
- Type
SelectionConnectOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
SelectionApi- Requirement
- n/a
dedupeSelectionIds
functiondedupeSelectionIdsts
declare function dedupeSelectionIds(ids: readonly string[]): SelectionValue;Name
Kind
Type
Requirement
idsparameter
readonly string[]required
returnreturn value
SelectionValuen/a
- Name
ids- Kind
- parameter
- Type
readonly string[]- Requirement
- required
- Name
return- Kind
- return value
- Type
SelectionValue- Requirement
- n/a
EMPTY_SELECTION_IDS
valueEMPTY_SELECTION_IDSts
export declare const EMPTY_SELECTION_IDS: SelectionValue;isSelectableId
functionisSelectableIdts
declare function isSelectableId(id: string, input: SelectionInput): boolean;Name
Kind
Type
Requirement
idparameter
stringrequired
inputparameter
SelectionInputrequired
returnreturn value
booleann/a
- Name
id- Kind
- parameter
- Type
string- Requirement
- required
- Name
input- Kind
- parameter
- Type
SelectionInput- Requirement
- required
- Name
return- Kind
- return value
- Type
boolean- Requirement
- n/a
rangeSelectionIds
functionrangeSelectionIdsts
declare function rangeSelectionIds(orderedIds: readonly string[], disabledIds: readonly string[], fromId: string | null, toId: string): SelectionValue;Name
Kind
Type
Requirement
orderedIdsparameter
readonly string[]required
disabledIdsparameter
readonly string[]required
fromIdparameter
string | nullrequired
toIdparameter
stringrequired
returnreturn value
SelectionValuen/a
- Name
orderedIds- Kind
- parameter
- Type
readonly string[]- Requirement
- required
- Name
disabledIds- Kind
- parameter
- Type
readonly string[]- Requirement
- required
- Name
fromId- Kind
- parameter
- Type
string | null- Requirement
- required
- Name
toId- Kind
- parameter
- Type
string- Requirement
- required
- Name
return- Kind
- return value
- Type
SelectionValue- Requirement
- n/a
runSelectionCommand
functionrunSelectionCommandts
declare function runSelectionCommand(command: SelectionCommand, _scope: PartScope, options?: SelectionConnectOptions): void;Name
Kind
Type
Requirement
commandparameter
SelectionCommandrequired
_scopeparameter
PartScoperequired
optionsparameter
SelectionConnectOptionsoptional
returnreturn value
voidn/a
- Name
command- Kind
- parameter
- Type
SelectionCommand- Requirement
- required
- Name
_scope- Kind
- parameter
- Type
PartScope- Requirement
- required
- Name
options- Kind
- parameter
- Type
SelectionConnectOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
void- Requirement
- n/a
sameSelectionIds
functionsameSelectionIdsts
declare function sameSelectionIds(left: SelectionValue, right: SelectionValue): boolean;Name
Kind
Type
Requirement
leftparameter
SelectionValuerequired
rightparameter
SelectionValuerequired
returnreturn value
booleann/a
- Name
left- Kind
- parameter
- Type
SelectionValue- Requirement
- required
- Name
right- Kind
- parameter
- Type
SelectionValue- Requirement
- required
- Name
return- Kind
- return value
- Type
boolean- Requirement
- n/a
selectionAnatomy
valueselectionAnatomyts
export declare const selectionAnatomy: { readonly scope: "selection"; readonly parts: readonly ["root", "item"];};Name
Kind
Type
Requirement
partsproperty
readonly ["root", "item"]required
scopeproperty
"selection"required
- Name
parts- Kind
- property
- Type
readonly ["root", "item"]- Requirement
- required
- Name
scope- Kind
- property
- Type
"selection"- Requirement
- required
SelectionApi
interfaceSelectionApits
interface SelectionApi { rootProps(): PartProps; itemProps(id: string): PartProps; selectAll(selectableIds?: SelectionValue): void; clear(): void; readonly selectedIds: SelectionValue; readonly anchorId: string | null; readonly mode: SelectionMode;}Name
Kind
Type
Requirement
anchorIdproperty
string | nullrequired
clearmethod
() => voidrequired
itemPropsmethod
(id: string) => PartPropsrequired
modeproperty
SelectionModerequired
rootPropsmethod
() => PartPropsrequired
selectAllmethod
(selectableIds?: SelectionValue) => voidrequired
selectedIdsproperty
SelectionValuerequired
- Name
anchorId- Kind
- property
- Type
string | null- Requirement
- required
- Name
clear- Kind
- method
- Type
() => void- Requirement
- required
- Name
itemProps- Kind
- method
- Type
(id: string) => PartProps- Requirement
- required
- Name
mode- Kind
- property
- Type
SelectionMode- Requirement
- required
- Name
rootProps- Kind
- method
- Type
() => PartProps- Requirement
- required
- Name
selectAll- Kind
- method
- Type
(selectableIds?: SelectionValue) => void- Requirement
- required
- Name
selectedIds- Kind
- property
- Type
SelectionValue- Requirement
- required
SelectionChangeDetailts
type SelectionChangeDetail = { readonly selectedIds: SelectionValue; readonly reason: SelectionChangeReason;};Name
Kind
Type
Requirement
reasonproperty
SelectionChangeReasonrequired
selectedIdsproperty
SelectionValuerequired
- Name
reason- Kind
- property
- Type
SelectionChangeReason- Requirement
- required
- Name
selectedIds- Kind
- property
- Type
SelectionValue- Requirement
- required
SelectionChangeReasonts
type SelectionChangeReason = "pointer" | "keyboard" | "programmatic";SelectionCommand
typeSelectionCommandts
type SelectionCommand = CommandObject & { readonly type: "SELECTION_CHANGE_REQUEST"; readonly selectedIds: SelectionValue; readonly reason: SelectionChangeReason;};Name
Kind
Type
Requirement
reasonproperty
SelectionChangeReasonrequired
selectedIdsproperty
SelectionValuerequired
typeproperty
stringrequired
- Name
reason- Kind
- property
- Type
SelectionChangeReason- Requirement
- required
- Name
selectedIds- Kind
- property
- Type
SelectionValue- Requirement
- required
- Name
type- Kind
- property
- Type
string- Requirement
- required
SelectionConnectOptions
interfaceSelectionConnectOptionsts
interface SelectionConnectOptions { readonly onSelectedIdsChange?: (detail: SelectionChangeDetail) => void; readonly selectableIds?: SelectionValue;}Name
Kind
Type
Requirement
onSelectedIdsChangeproperty
(detail: SelectionChangeDetail) => voidoptional
selectableIdsproperty
SelectionValueoptional
- Name
onSelectedIdsChange- Kind
- property
- Type
(detail: SelectionChangeDetail) => void- Requirement
- optional
- Name
selectableIds- Kind
- property
- Type
SelectionValue- Requirement
- optional
SelectionContext
typeSelectionContextts
type SelectionContext = { readonly mode: BindingMode; readonly selectedIds: SelectionValue; readonly anchorId: string | null;};Name
Kind
Type
Requirement
anchorIdproperty
string | nullrequired
modeproperty
BindingModerequired
selectedIdsproperty
SelectionValuerequired
- Name
anchorId- Kind
- property
- Type
string | null- Requirement
- required
- Name
mode- Kind
- property
- Type
BindingMode- Requirement
- required
- Name
selectedIds- Kind
- property
- Type
SelectionValue- Requirement
- required
SelectionEvent
typeSelectionEventts
type SelectionEvent = { readonly type: "SELECT"; readonly id: string; readonly reason: SelectionChangeReason;} | { readonly type: "TOGGLE"; readonly id: string; readonly reason: SelectionChangeReason;} | { readonly type: "RANGE_EXTEND"; readonly id: string; readonly reason: SelectionChangeReason;} | { readonly type: "SELECT_ALL"; readonly selectableIds: readonly string[]; readonly reason: SelectionChangeReason;} | { readonly type: "CLEAR"; readonly reason: SelectionChangeReason;} | { readonly type: "REPLACE"; readonly selectedIds: SelectionValue; readonly reason: SelectionChangeReason;} | { readonly type: "RESET";};selectionEventFromKeyboard
functionselectionEventFromKeyboardts
declare function selectionEventFromKeyboard(mode: SelectionMode, id: string, event: KeyboardEventLike): SelectionEvent | null;Name
Kind
Type
Requirement
modeparameter
SelectionModerequired
idparameter
stringrequired
eventparameter
KeyboardEventLikerequired
returnreturn value
SelectionEvent | nulln/a
- Name
mode- Kind
- parameter
- Type
SelectionMode- Requirement
- required
- Name
id- Kind
- parameter
- Type
string- Requirement
- required
- Name
event- Kind
- parameter
- Type
KeyboardEventLike- Requirement
- required
- Name
return- Kind
- return value
- Type
SelectionEvent | null- Requirement
- n/a
selectionEventFromPointer
functionselectionEventFromPointerts
declare function selectionEventFromPointer(mode: SelectionMode, id: string, event?: ClickLikeEvent): SelectionEvent | null;Name
Kind
Type
Requirement
modeparameter
SelectionModerequired
idparameter
stringrequired
eventparameter
ClickLikeEventoptional
returnreturn value
SelectionEvent | nulln/a
- Name
mode- Kind
- parameter
- Type
SelectionMode- Requirement
- required
- Name
id- Kind
- parameter
- Type
string- Requirement
- required
- Name
event- Kind
- parameter
- Type
ClickLikeEvent- Requirement
- optional
- Name
return- Kind
- return value
- Type
SelectionEvent | null- Requirement
- n/a
SelectionInput
interfaceSelectionInputts
interface SelectionInput { readonly mode: SelectionMode; readonly selectedIds?: SelectionValue; readonly defaultSelectedIds?: SelectionValue; readonly orderedIds: readonly string[]; readonly disabledIds?: readonly string[];}Name
Kind
Type
Requirement
defaultSelectedIdsproperty
SelectionValueoptional
disabledIdsproperty
readonly string[]optional
modeproperty
SelectionModerequired
orderedIdsproperty
readonly string[]required
selectedIdsproperty
SelectionValueoptional
- Name
defaultSelectedIds- Kind
- property
- Type
SelectionValue- Requirement
- optional
- Name
disabledIds- Kind
- property
- Type
readonly string[]- Requirement
- optional
- Name
mode- Kind
- property
- Type
SelectionMode- Requirement
- required
- Name
orderedIds- Kind
- property
- Type
readonly string[]- Requirement
- required
- Name
selectedIds- Kind
- property
- Type
SelectionValue- Requirement
- optional
selectionMachine
valueselectionMachinets
export declare const selectionMachine: SelectionMachine;SelectionMode
typeSelectionModets
type SelectionMode = "none" | "single" | "multiple";SelectionPart
typeSelectionPartts
type SelectionPart = (typeof selectionAnatomy.parts)[number];selectionSelectors
valueselectionSelectorsts
export declare const selectionSelectors: { selectedIds: (snapshot: SelectionSnapshot) => SelectionValue; anchorId: (snapshot: SelectionSnapshot) => string | null; bindingMode: (snapshot: SelectionSnapshot) => BindingMode; isSelected: (snapshot: SelectionSnapshot, id: string) => boolean;};Name
Kind
Type
Requirement
anchorIdproperty
(snapshot: SelectionSnapshot) => string | nullrequired
bindingModeproperty
(snapshot: SelectionSnapshot) => BindingModerequired
isSelectedproperty
(snapshot: SelectionSnapshot, id: string) => booleanrequired
selectedIdsproperty
(snapshot: SelectionSnapshot) => SelectionValuerequired
- Name
anchorId- Kind
- property
- Type
(snapshot: SelectionSnapshot) => string | null- Requirement
- required
- Name
bindingMode- Kind
- property
- Type
(snapshot: SelectionSnapshot) => BindingMode- Requirement
- required
- Name
isSelected- Kind
- property
- Type
(snapshot: SelectionSnapshot, id: string) => boolean- Requirement
- required
- Name
selectedIds- Kind
- property
- Type
(snapshot: SelectionSnapshot) => SelectionValue- Requirement
- required
SelectionService
typeSelectionServicets
type SelectionService = Service<SelectionInput, SelectionStateValue, SelectionContext, SelectionEvent, SelectionCommand>;SelectionSnapshot
typeSelectionSnapshotts
type SelectionSnapshot = Snapshot<SelectionStateValue, SelectionContext>;SelectionStateValue
typeSelectionStateValuets
type SelectionStateValue = "ready";SelectionValue
typeSelectionValuets
type SelectionValue = readonly string[];Framework adapters
Each panel keeps its adapter's public vocabulary. React compound exports, Vue composables, standalone Angular declarations, Svelte components, and Solid hooks stay native to their framework.
This entry is core-only. No framework adapter package ships for selection yet — mount it through the vanilla API above.