Skip to content

ele.label()

eles.label — Collection > Style. Cytoscape.js signatures, parameters and return contract.

eles.label — Collection › Style

Preview · Collection › Style

Read in the complete API reference · All API members

// The node's resolved label text ('' when none)
ele.label(): string | undefined

The node's resolved label text ('' when none). To set the label, update the stylesheet or the data field it reads.

Returns string | undefined

the resolved text of the first element's label — '' when it has none (a labelled-but-empty label reads the same), and undefined when the collection is empty or the element was removed

Example

console.log(eles.label()); // ""

Example graph and handle setup