Skip to content

API reference

cy.selectionType — Core > Interaction controls. Cytoscape.js signatures, parameters and return contract.

cy.selectionType — Core › Interaction controls

Preview · Core › Interaction controls

Read in the complete API reference · All API members

#cy.selectionType()

// How user selection composes: 'single' (a tap or box replaces the selection) or 'additive' (taps toggle and boxes add, as if a multiple-select key were always held)
cy.selectionType(): 'single' | 'additive'

How user selection composes: 'single' (a tap or box replaces the selection) or 'additive' (taps toggle and boxes add, as if a multiple-select key were always held).

Returns 'single' | 'additive'

the current selectionType value

Example

console.log(cy.selectionType()); // "single"

Example graph and handle setup

Throws

if type is neither 'single' nor 'additive'

#cy.selectionType(type)

// How user selection composes: 'single' (a tap or box replaces the selection) or 'additive' (taps toggle and boxes add, as if a multiple-select key were always held)
cy.selectionType(type: 'single' | 'additive'): this

How user selection composes: 'single' (a tap or box replaces the selection) or 'additive' (taps toggle and boxes add, as if a multiple-select key were always held).

Parameters
NameDescription
type: 'single' | 'additive'

the new mode

Returns this

this core, for chaining

Example

const result = cy.selectionType("single");
console.log(result === cy); // true

Example graph and handle setup

Throws

if type is neither 'single' nor 'additive'