Function

useTimelineSelection

Provides the canonical selected clip/track model for timeline editor chrome.

Usage notes

Use this hook when UI needs selection state without the broader clip command surface from useTimelineClips. It is a good fit for inspectors, selection badges, grouped-clip panels, and toolbar enablement.

Signature

Type Definition
useTimelineSelection(): UseTimelineSelectionResult

Returns

Selected clip and track state plus selection commands.

Examples

tsx Example
import { useTimelineSelection } from '@techsquidtv/canvas-timeline-react';
export function SelectionSummary() {
const selection = useTimelineSelection();
if (!selection.hasSelection) {
return <p>No selection</p>;
}
return (
<p>
{selection.selectedClipIds.length} clips selected
{selection.selectedTrack ? ` on ${selection.selectedTrack.name}` : ''}
</p>
);
}