Skip to content

Component Reference

Components a node’s frontend widget can import and trigger from @/components.


A visual audio trimmer. Use this in any node that accepts an audio file input where the user might need to select a time range.

Props:

PropTypeDescription
isOpenbooleanControls visibility
audioSrcstring | nullURL of the audio file to trim
onClose() => voidCalled when the modal is dismissed
onConfirm(start: number, end: number) => voidCalled with trim timestamps in seconds

Usage:

import { AudioTrimmerModal } from "@/components/AudioTrimmerModal";
<AudioTrimmerModal
isOpen={showTrimmer}
audioSrc={uploadedAudioUrl}
onClose={() => setShowTrimmer(false)}
onConfirm={async (start, end) => {
const res = await fetch("/api/audio/trim", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ filePath: uploadedAudioUrl, start, end, sessionId }),
});
const data = await res.json();
setTrimmedAudioUrl(data.filePath);
setShowTrimmer(false);
}}
/>

What it does:

  • Decodes the audio buffer and renders a waveform canvas
  • Provides draggable handles for selecting the start/end range
  • Supports playback scoped to the selected region