Function

useTimelineKeyboard

Provides focus-scoped timeline keyboard shortcuts. The hook never installs global listeners. It handles shortcuts only from the element that spreads `scopeProps` or one of that element's descendants. Commands read current engine state without subscribing to document or viewport updates. Use `commandHandlers.togglePlayback` to compose media-aware transport.

Signature

Type Definition
useTimelineKeyboard(options: TimelineKeyboardOptions = {}): UseTimelineKeyboardResult

Parameters

NameTypeDescription
optionsTimelineKeyboardOptionsKeyboard preset, custom bindings, frame rate, and event handling options.

Returns

Current bindings, scope props, a shortcut matcher, and a command executor.

Examples

tsx Example
const keyboard = useTimelineKeyboard({
commandHandlers: { togglePlayback: () => media.playing ? media.pause() : media.play() },
});
return <div {...keyboard.scopeProps}>Timeline surface</div>;