Valora
API Reference@valora-ai/reactindexFunctions

TrackToggle

function TrackToggle<T>(__namedParameters): Element;

Defined in: packages/react/src/components/track/TrackToggle.tsx:64

With the TrackToggle component it is possible to mute and unmute your camera and microphone. The component uses an html button element under the hood so you can treat it like a button.

Type Parameters

Type ParameterDefault type
TToggleSource

Parameters

ParameterType
__namedParametersTrackToggleProps<T>

Returns

Element

Example

// Basic — toggle microphone and camera publishing.
<VoiceRoom agent={agent}>
  <TrackToggle source={Track.Source.Microphone} />
  <TrackToggle source={Track.Source.Camera} />
</VoiceRoom>

// Advanced — react to user-initiated mute changes.
<VoiceRoom agent={agent}>
  <div className="call-controls">
    <TrackToggle
      source="microphone"
      initialEnabled
      onChange={(enabled, isUserInitiated) => {
        if (isUserInitiated) logMicChange(enabled);
      }}
    />
    <StartAudio label="Enable audio" />
  </div>
</VoiceRoom>

On this page

Valora is local-first

No API key, no server — everything in this doc runs on-device.

Star on GitHub