Skip to main content

getCanvasSelectionItemKey()v4.0.527

Returns an identity string for a CanvasSelectionItem. Use it to compare selection items from different snapshots or construct React list keys.

warning

Experimental API: This package is not stable. Its public API may change without a major version bump.

is-selected.ts
import { getCanvasSelectionItemKey, type CanvasSelectionItem, type CanvasSelectionSnapshot, } from '@remotion/canvas'; export const isSelected = ( item: CanvasSelectionItem, selection: CanvasSelectionSnapshot, ) => selection.selectedItems.some( (selected) => getCanvasSelectionItemKey(selected) === getCanvasSelectionItemKey(item), );

Parameter

item

A CanvasSelectionItem, such as {type: 'sequence', nodePathInfo}. Other item types can represent a property, effect, keyframe, easing segment, or guide.

Return value

A string that is equal for items with the same selection identity. Treat its format as opaque; it may change while the package is experimental. If an item's nodePathInfo uses the fallback mounted sequence ID from getCanvasSequenceNodePathInfo(), its key can change after a remount.

Compatibility

BrowsersEnvironments
Chrome
Firefox
Safari

See also