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
useTimelineSelection(): UseTimelineSelectionResult<TrackKind>Type parameters
| Name | Constraint | Default | Description |
|---|---|---|---|
TrackKind | None | string | App-defined track kind values carried by selected tracks. |
Returns
UseTimelineSelectionResult<TrackKind>
Selected clip and track state plus selection commands.
Examples
import { useTimelineSelection } from '#react/hooks';
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> );}